Skip to main content

grph has-path

Check if a path exists between two nodes.

Synopsis

grph has-path <file> <source> <target>

Description

The has-path command quickly checks whether any path exists between two nodes. This is faster than grph path when you only need to know if connectivity exists.

Arguments

ArgumentDescription
filePath to the GEXF file (required)
sourceID of the starting node (required)
targetID of the destination node (required)

Examples

Basic Usage

grph has-path network.gexf lb1 db1

Output (if path exists):

Yes - a path exists from lb1 to db1

Output (if no path):

No - no path exists from lb1 to db1

Use Cases

Connectivity Check

Verify two components can communicate:

grph has-path network.gexf client server

Dependency Verification

Check if a dependency relationship exists:

grph has-path dagger-graph.gexf FeatureModule CoreLibrary

Scripting

Use in scripts for conditional logic:

if grph has-path graph.gexf nodeA nodeB 2>&1 | grep -q "Yes"; then
echo "Connected"
fi