次の NetworkX コードに相当する GraphLab は何ですか?
for nodeset in nx.connected_components(G):
GraphLab で、接続された各コンポーネントの頂点 ID のセットを取得したいと考えています。
によって返されるコンポーネント ID はgraphlab.graph_analytics.connected_components
SFrame の形式であるため、特定のコンポーネントの ID を取得する最も簡単な方法は、SFrame をフィルタリングすることです。
# Make a graph with two components.
import graphlab
G = graphlab.SGraph().add_edges(
[graphlab.Edge(i, i+1) for i in range(3)])
G = G.add_edges([graphlab.Edge(i, i+1) for i in range(4, 6)])
# Get the connected components.
cc = graphlab.connected_components.create(G)
# Find the vertices for a given component (0, in this example).
nodes = cc.component_id.filter_by(0, 'component_id')
print nodes
+------+--------------+
| __id | component_id |
+------+--------------+
| 5 | 0 |
| 6 | 0 |
| 4 | 0 |
+------+--------------+
[3 rows x 2 columns]