Linux command
ccomps 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Print components
ccomps -x [input.dot]
Write each component
ccomps -x -o [out.dot] [input.dot]
Print only the largest component
ccomps -z -x [input.dot]
Count the components
ccomps -sv [input.dot]
Extract the component containing a specific node
ccomps -X [node_name] [input.dot]
Output components by size range
ccomps -x -X%5- [input.dot]
说明
ccomps decomposes graphs into their connected components, printing the components to standard output. By default, every node ends up in some component; with -C the cluster subgraph structure is also used to determine connectivity. For undirected graphs it computes connected components; for directed graphs it treats edges as undirected (weakly connected). The tool is useful for filtering disconnected subgraphs out of a graph, isolating the component containing a node of interest, or pre-processing graphs before layout with dot, neato, etc. If no input file is given, the graph is read from standard input.
参数
- -s
- Silent: print no output graph; useful with -v to just check connectivity.
- -x
- Print each connected component as a separate graph (instead of embedding them as subgraphs).
- -X _node_name_
- Print only the component containing the named node.
- -X# _index_-[_last_]
- Print only the component(s) at the given index, or index range (last optional).
- -X% _min_-[_max_]
- Print only the component(s) whose node count falls in the given size range.
- -z
- Sort components by size, largest first. Only meaningful with -x or -X#.
- -C
- Use cluster subgraphs in addition to normal edge connectivity when computing components.
- -e
- Do not induce edges in the connected components.
- -n
- Do not project subgraph structure: components contain only relevant nodes and edges.
- -v
- Verbose: print counts of nodes, edges and components to stderr.
- -o _outfile_
- Write output to _outfile_. With multiple components, files are numbered (_outfile_, _outfile_\_1, ...).
- -?
- Print usage information.
FAQ
What is the ccomps command used for?
ccomps decomposes graphs into their connected components, printing the components to standard output. By default, every node ends up in some component; with -C the cluster subgraph structure is also used to determine connectivity. For undirected graphs it computes connected components; for directed graphs it treats edges as undirected (weakly connected). The tool is useful for filtering disconnected subgraphs out of a graph, isolating the component containing a node of interest, or pre-processing graphs before layout with dot, neato, etc. If no input file is given, the graph is read from standard input.
How do I run a basic ccomps example?
Run `ccomps -x [input.dot]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -s do in ccomps?
Silent: print no output graph; useful with -v to just check connectivity.