inner_nodes() (graph function)
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
The inner_nodes()
graph function allows access to the inner nodes of a variable length edge. It can only be used as the first parameter of the all() graph and map() functions.
Note
This function is used with the graph-match operator, graph-shortest-paths operator, all() function, and map() function.
Syntax
inner_nodes(
edge)
Parameters
Name | Type | Required | Description |
---|---|---|---|
edge | string |
✔️ | A variable length edge from the graph-match operator or graph-shortest-paths operator pattern. For more information, see Graph pattern notation. |
Returns
Sets the execution scope of the all
or map
expression to the inner node of a variable length edge.
Examples
The example in this section shows how to use the syntax to help you get started.
Find all employees in a manager's organization
The following example represents an organizational hierarchy. It shows how a variable length edge in a single graph query can be used to find employees at various levels within an organizational hierarchy. The nodes in the graph represent employees and the edges connect an employee to their manager. After the graph is built using the make-graph
operator, the all()
and inner_nodes
functions are used to search for employees in Alice's organization besides Alice, who have managers younger than 40. Then, map()
and inner_nodes
are used together to get those managers' names.
let employees = datatable(name:string, age:long)
[
"Alice", 32,
"Bob", 31,
"Eve", 27,
"Joe", 29,
"Chris", 45,
"Alex", 35,
"Ben", 23,
"Richard", 39,
];
let reports = datatable(employee:string, manager:string)
[
"Bob", "Alice",
"Chris", "Alice",
"Eve", "Bob",
"Ben", "Chris",
"Joe", "Alice",
"Richard", "Bob"
];
reports
| make-graph employee --> manager with employees on name
| graph-match (manager)<-[reports*1..5]-(employee)
where manager.name == "Alice" and all(inner_nodes(reports), age < 40)
project employee = employee.name, manager = manager.name, reportingPath = map(inner_nodes(reports), name)
Output
employee | manager | reportingPath |
---|---|---|
Bob | Alice | [] |
Chris | Alice | [] |
Joe | Alice | [] |
Eve | Alice | ["Bob"] |
Richard | Alice | ["Bob"] |