次の方法で共有


graph-mark-components 演算子 (プレビュー)

適用対象: ✅Microsoft FabricAzure データ エクスプローラーAzure MonitorMicrosoft Sentinel

graph-mark-components演算子は、グラフのすべての接続されたコンポーネントを検索し、各ノードをコンポーネント識別子でマークします。

この演算子は、make-graph 演算子と共に使用されます。

構文

G|graph-mark-components [kind=Kind] [with_component_id=ComponentId]

パラメーター

件名 タイプ 必須 説明
G ひも ✔️ グラフ ソース。
親切 ひも 接続されたコンポーネントの種類 ( weak (既定) または strong。 弱いコンポーネントは、エッジの方向を無視して、パスによって接続されたノードのセットです。 強いコンポーネントは、エッジの方向を考慮して双方向に接続されたノードのセットです。
ComponentId ひも コンポーネント識別子を表すプロパティ名。 既定のプロパティ名は ComponentId

返品

graph-mark-components演算子はグラフ結果を返します。各ノードには、ComponentId プロパティにコンポーネント識別子があります。 識別子は、コンポーネントの 0 から始まる連続するインデックスです。 各コンポーネント インデックスは任意に選択され、実行間で一貫性がない可能性があります。

次の例では、子と親のペアのセットからグラフを作成し、 family 識別子を使用して接続されているコンポーネントを識別します。

let ChildOf = datatable(child:string, parent:string) 
[ 
  "Alice", "Bob",  
  "Carol", "Alice",  
  "Carol", "Dave",  
  "Greg", "Alice",  
  "Greg", "Dave",  
  "Howard", "Alice",  
  "Howard", "Dave",  
  "Eve", "Frank",  
  "Frank", "Mallory",
  "Eve", "Kirk",
]; 
ChildOf 
| make-graph child --> parent with_node_id=name
| graph-mark-components with_component_id = family
| graph-to-table nodes

出力

名前 家族
アリス 0
ボブ 0
キャロル 0
デイブ 0
グレッグ 0
ハワード 0
前夜祭 1
Frank Weigel 1
Mallory 1
カーク 1

次の例では、接続されたコンポーネント family 識別子と graph-match 演算子を使用して、一連の子親データ内の各ファミリの最大の先祖を識別します。

let ChildOf = datatable(child:string, parent:string) 
[ 
  "Alice", "Bob",  
  "Carol", "Alice",  
  "Carol", "Dave",  
  "Greg", "Alice",  
  "Greg", "Dave",  
  "Howard", "Alice",  
  "Howard", "Dave",  
  "Eve", "Frank",  
  "Frank", "Mallory",
  "Eve", "Kirk",
]; 
ChildOf 
| make-graph child --> parent with_node_id=name
| graph-mark-components with_component_id = family
| graph-match (descendant)-[childOf*1..5]->(ancestor)
  project name = ancestor.name, lineage = map(childOf, child), family = ancestor.family
| summarize (generations, name) = arg_max(array_length(lineage),name) by family

出力

家族 世代 名前
1 2 Mallory
0 2 ボブ