Skip to main content

grph degree

Show node degree information.

Synopsis

grph degree <file> [--node NODE_ID] [--top N] [--json]

Description

The degree command shows degree information for nodes. For directed graphs, it displays in-degree (incoming edges), out-degree (outgoing edges), and total degree.

Arguments

ArgumentDescription
filePath to the GEXF file (required)

Options

OptionDefaultDescription
--nodeShow degree for a specific node
--top10Number of top nodes to display
--jsonOutput as JSON
--helpShow help message

Examples

Top Nodes by Degree

grph degree network.gexf

Output for directed graph:

     Node Degrees (Top 10)
+------+---------+----+-----+-------+
| Rank | Node | In | Out | Total |
+------+---------+----+-----+-------+
| 1 | hub1 | 5 | 8 | 13 |
| 2 | server1 | 3 | 4 | 7 |
| 3 | db1 | 4 | 0 | 4 |
+------+---------+----+-----+-------+

Specific Node

grph degree network.gexf --node server1

Output:

        Node Degree
+-------------+-------+
| Property | Value |
+-------------+-------+
| Node | server1|
| In-Degree | 3 |
| Out-Degree | 4 |
| Total Degree| 7 |
+-------------+-------+

More Results

grph degree network.gexf --top 25

JSON Output

grph degree network.gexf --json

Use Cases

Find Hub Nodes

Identify highly connected nodes:

grph degree network.gexf --top 5

Find Leaf Nodes

Nodes with low degree are often endpoints:

grph degree network.gexf --json | jq '.degrees | map(select(.total_degree == 1))'

Dependency Analysis

Find components with many dependencies:

grph degree dagger-graph.gexf --top 10
# High out-degree = many dependencies
# High in-degree = many dependents