Connected Components
The Connected Components algorithm identifies the connected vertices in an undirected graph. The algorithm returns a unique connected component ID for each vertex in the graph.
Connected Components Syntax
Graph algorithms are accessed from an internal SPARQL service endpoint. To incorporate the Connected Components algorithm in a query, include a SERVICE statement in the WHERE clause. The service call specifies the name of the algorithm and defines the required and optional property values for that algorithm.
Use the following syntax to find the connected components in a graph. The table below describes each property.
SERVICE <csi:connected_components> { [] <csi:binding-vertex> ?vertex_variable_name ; <csi:binding-id> ?component_id_variable_name ; <csi:edge-label> <edge_uri> ; [ <csi:graph> <graph_uri> ] . }
Property | Description | Default Value & Range |
---|---|---|
<csi:binding-vertex> | Required property that defines the name to use for the result column that lists the source nodes or vertices. | Range: Must be a variable name Default: none |
<csi:binding-id> | Required property that defines the name to use for the result column that lists the assigned component identifiers. | Range: Must be a variable name Default: none |
<csi:edge-label> | Required property that lists the edge URI that defines the graph to operate on. The graph is the set of vertices that are connected by this URI. | Range: Must be a URI Default: none |
<csi:graph> | Optional property that specifies the graph to query. | Range: Must be a URI Default: none |