node_id() (graph function)

Switch services using the Version drop-down list. Learn more about navigation.
Applies to: ✅ Azure Data Explorer

The node_id function calculates the graph node identifier as it was set by the user either in make-graph or graph model.

Note

This function is used with the graph-match and graph-shortest-paths operators.

Warning

This feature is currently in public preview. Functionality and syntax are subject to change before General Availability.

Syntax

node_id([node])

Learn more about syntax conventions.

Parameters

Name Type Required Description
node string The reference to a graph node variable in a graph pattern.
Don't pass any parameters when used inside all(), any(), and map() graph functions, with inner_nodes().

Returns

Returns the node ID string representation of the input node or of all inner nodes, when used inside all(), any(), and map() functions with inner_nodes().

Example

The following example creates a graph to analyze a hierarchical structure of employees and their managers.

let employees = datatable(name:string, age:long)
[
"Alice", 32,
"Bob", 31,
"Eve", 27,
];
let reports = datatable(employee:string, manager:string)
[
"Bob", "Alice",
"Chris", "Alice",
"Eve", "Bob",
];
reports
| make-graph employee --> manager with employees on name
| graph-match (employee)-[reports*1..3]->(manager)
    where node_id(employee) startswith "E"
    project manager1 = node_id(manager), manager2 = map(inner_nodes(reports), node_id())

Output

manager_1 manager_2
Bob []
Alice ["Bob"]