Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions data-explorer/kusto/query/make-graph-operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ The `make-graph` operator builds a graph structure from tabular inputs of edges

*Edges* `|` `make-graph` *SourceNodeId* `-->` *TargetNodeId* [ `with` *Nodes1* `on` *NodeId1* [`,` *Nodes2* `on` *NodeId2* ]] `partitioned-by` *PartitionColumn* `(` *GraphOperator* `)`

*Edges* `|` `make-graph` *SourceNodeId* `-->` *TargetNodeId* [ `with_node_id=` *NodeIdPropertyName* ] `partitioned-by` *PartitionColumn* `(` *GraphOperator* `)`

## Parameters

| Name | Type | Required | Description |
Expand All @@ -40,6 +38,9 @@ The `make-graph` operator returns a graph expression and must be followed by a [

When using the `partitioned-by` clause, separate graphs are created for each unique value in the specified *PartitionColumn*. The specified *GraphOperator* is then applied to each partitioned graph independently, and the results are combined into a single output. This is particularly useful for multitenant scenarios where you want to analyze each tenant's data separately while maintaining the same graph structure and analysis logic.

> [!IMPORTANT]
> When using the `partitioned-by` clause, both the *Edges* table and all *Nodes* tables must contain the partition column.

> [!NOTE]
> Each node has a unique identifier. If the same node ID appears in both the *Nodes1* and *Nodes2* tables, a single node is created by merging their properties. If there are conflicting property values for the same node, one of the values is arbitrarily chosen.

Expand Down Expand Up @@ -123,13 +124,15 @@ edges
|---|---|---|
|Mallory|Bob|Trent|

### Multitenant partitioned graph
### Partitioned graph

This example demonstrates using the `partitioned-by` clause to analyze a multitenant social network. The `partitioned-by` clause creates separate graphs for each unique value in the partition column (in this case, `tenantId`), applies the graph operator to each partition independently, and combines the results.

:::image type="content" source="media/graphs/graph-example-make-graph-partitioned.png" alt-text="A graph showing three different companies which are representing three different partitions.":::

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
> <a href="https://dataexplorer.azure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ik1NlNY6mFrZr3USuVI%2BfrYqHqYWqO1OuwzaV57TyrY%2F0H8UCx2eE019V%2B1sq5wD5MPSpqyqoOVKpZO5pMbQuv5%2BNH5gVStlNYMvo4g9SpXuQgN6jQJS4aY15Z5UZnTfKkbKSgJLoFsUKGFaLunC9rMpXsNy4uSIE%2FuZwUJmP%2BLE3mZ8MRMfceIgs1%2B4x487cXhMwlpjt1FYReGGLPV7tobivV7OtHPi9NCJuzJlk3LKMm%2B5G50stopp0kLYUTvOT07pWUm4LBuVb9aWqjD%2BqOe3VIWcu%2FN8z2SkNJFU%2FoYle8LmQrE4hP1MAs3mm4MsAi%2F0VZB9aslNRqJO8%2BXEjf8xaD6utxkGailPara5ZNoPwV%2F7VBeOBA2FmnDqzXv81W21vIfmm5pw6%2Bl487yEqBCE08oUfhmBcPMGE%2FQXRTUs5i4YjSzP183wrd2UB%2BXXgAowc9F%2FdWOTw5OaloFcmURKmvmnXmsvrd%2B3H%2BqUO380ynnIbpujz86E%2B1NCR0aRUB1%2BB6dNz1YwVvIvuq1gRlum6XqgBE5TDaz51KXdhxptPDXzHaKuepXk5tl39YgCITZ%2BzQfQb5fk7Z0p99CUa5mq1P8FZTuk0NUPAAA%3D" target="_blank">Run the query</a>
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAA62XbW%2FiOBDH3yPxHeZ4BSugJDz3risB7T702t1q6el0qqqVm4yIr8GOHEPFPXz3G4cEghNut9ylqogd2%2FPLzPjvSYgahPQxhgvwmaa%2FpxDrqxjVR%2F881oqLRRM0CiZ0rkOwJe4aPkZM6SUKvetSMtw%2FD6XHNJfi3N%2FQPO41oFp5qFaArrMzuE%2FWPoeZXEZMbCbQgjkT8E4x4fHYkzBlG5goZNsZtVWn49SaUMvGm%2FtJyD2EaxmIWArTcSUWXCAa%2B6Y5R8GlgktcYygjVNSXstT%2FrOlNhLVzqN1JLrQZ7UmpfC6Yxpj6H1qO67Z7zrjXhO6wPRz2xo9%2FN5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y5Ss21oy7QXgbTwqHy8EjYW6cBqtB3zjttu9x9bbunAb2wnmeglQIQinndr44QKEmzWYoP8wrGNR1uDiwopAwwzfL5wQofzqU51maoGvbmQkPq5r6cuVEVkymn0btnOq%2F9B5bJCufmuU85idRkev%2FRrud1k6MoosNeAncDp07S1GSv5OxxnMKW6aDg%2BSd5prcM3XMWUB1CkBqJmFiboaNbK3rbLMebNkkXFtNoCeXZHD90u5h0u51lLVSuMfDsaDr78PAAA%3D" target="_blank">Run the query</a>
::: moniker-end

```kusto
Expand All @@ -139,8 +142,8 @@ let nodes = datatable(userId:string, tenantId:string, name:string, department:st
// Tenant: CompanyA - San Francisco Bay Area
"u001", "CompanyA", "Alice Johnson", "Engineering", "Senior Developer", dynamic({"type": "Point", "coordinates": [-122.4194, 37.7749]}),
"u002", "CompanyA", "Bob Smith", "Engineering", "Team Lead", dynamic({"type": "Point", "coordinates": [-122.4094, 37.7849]}),
"u003", "CompanyA", "Charlie Brown", "Marketing", "Manager", dynamic({"type": "Point", "coordinates": [-122.4294, 37.7649]}),
"u004", "CompanyA", "Diana Prince", "HR", "Director", dynamic({"type": "Point", "coordinates": [-122.3994, 37.7949]}),
"u003", "CompanyA", "Charlie Black", "Marketing", "Manager", dynamic({"type": "Point", "coordinates": [-122.4294, 37.7649]}),
"u004", "CompanyA", "Diana Finch", "HR", "Director", dynamic({"type": "Point", "coordinates": [-122.3994, 37.7949]}),
"u005", "CompanyA", "Eve Wilson", "Engineering", "Junior Developer", dynamic({"type": "Point", "coordinates": [-122.4394, 37.7549]}),
// Tenant: CompanyB - New York Area
"u006", "CompanyB", "Frank Miller", "Sales", "Account Manager", dynamic({"type": "Point", "coordinates": [-74.0060, 40.7128]}),
Expand Down Expand Up @@ -192,7 +195,7 @@ edges

|Start|Tenants|End|
|---|---|---|
|Bob Smith (CompanyA)|[<br> "CompanyA",<br> "CompanyA"<br>]|Diana Prince (CompanyA)|
|Bob Smith (CompanyA)|[<br> "CompanyA",<br> "CompanyA"<br>]|Diana Finch (CompanyA)|
|Henry Davis (CompanyB)|[<br> "CompanyB",<br> "CompanyB"<br>]|Grace Lee (CompanyB)|

## Related content
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.