On this page

DotGraph

linnet_py Class

DotGraph()

DOT-backed hedge graph.

Member details

global_data

Property · read/write
## setter
global_data: GlobalData

Global graph attributes.

Setter

global_data: GlobalData
Parameters
NameTypeDefaultDescription
valueGlobalData

from_string

Class method
#
from_string(s: str) -> DotGraph

Parse a DOT string into a graph.

Parameters

NameTypeDefaultDescription
sstr

from_string_set

Class method
#
from_string_set(s: str) -> list[DotGraph]

Parse a DOT string into multiple graphs.

Parameters

NameTypeDefaultDescription
sstr

from_file

Class method
#
from_file(path: str) -> DotGraph

Parse a DOT file into a graph.

Parameters

NameTypeDefaultDescription
pathstr

debug_dot

Method
#
debug_dot() -> str

Serialize graph to DOT for debugging.

dot

Method
#
dot() -> str

Serialize the full graph to DOT.

dot_of

Method
#
dot_of(subgraph: Subgraph) -> str

Serialize a subgraph to DOT.

Parameters

NameTypeDefaultDescription
subgraphSubgraph

n_nodes

Method
#
n_nodes() -> int

Number of nodes.

n_edges

Method
#
n_edges() -> int

Number of edges.

n_hedges

Method
#
n_hedges() -> int

Number of hedges.

n_externals

Method
#
n_externals() -> int

Number of external hedges.

n_internals

Method
#
n_internals() -> int

Number of internal hedges.

full_filter

Method
#
full_filter() -> Subgraph

Subgraph including all hedges.

empty_subgraph

Method
#
empty_subgraph() -> Subgraph

Empty subgraph of this graph.

iter_edges

Method
#
iter_edges() -> list[tuple[HedgePair, EdgeIndex, EdgeData]]

Iterate edges in the full graph.

iter_edges_of

Method
#
iter_edges_of(subgraph: Subgraph) -> list[tuple[HedgePair, EdgeIndex, EdgeData]]

Iterate edges within a subgraph.

Parameters

NameTypeDefaultDescription
subgraphSubgraph

iter_nodes

Method
#
iter_nodes() -> list[tuple[NodeIndex, list[Hedge], DotVertexData]]

Iterate nodes in the full graph.

iter_nodes_of

Method
#
iter_nodes_of(subgraph: Subgraph) -> list[tuple[NodeIndex, list[Hedge], DotVertexData]]

Iterate nodes within a subgraph.

Parameters

NameTypeDefaultDescription
subgraphSubgraph

connected_components

Method
#
connected_components(subgraph: Subgraph) -> list[Subgraph]

Connected components of a subgraph.

Parameters

NameTypeDefaultDescription
subgraphSubgraph

count_connected_components

Method
#
count_connected_components(subgraph: Subgraph) -> int

Count connected components.

Parameters

NameTypeDefaultDescription
subgraphSubgraph

is_connected

Method
#
is_connected(subgraph: Subgraph) -> bool

Whether a subgraph is connected.

Parameters

NameTypeDefaultDescription
subgraphSubgraph

depth_first_traverse

Method
#
depth_first_traverse(subgraph: Subgraph, root_node: NodeIndex, include_hedge: Optional[Hedge]) -> TraversalTree

Depth-first traversal from a root node.

Parameters

NameTypeDefaultDescription
subgraphSubgraph
root_nodeNodeIndex
include_hedgeOptional[Hedge]

breadth_first_traverse

Method
#
breadth_first_traverse(subgraph: Subgraph, root_node: NodeIndex, include_hedge: Optional[Hedge]) -> TraversalTree

Breadth-first traversal from a root node.

Parameters

NameTypeDefaultDescription
subgraphSubgraph
root_nodeNodeIndex
include_hedgeOptional[Hedge]

bridges

Method
#
bridges() -> Subgraph

Bridges in the full graph.

bridges_of

Method
#
bridges_of(subgraph: Subgraph) -> Subgraph

Bridges within a subgraph.

Parameters

NameTypeDefaultDescription
subgraphSubgraph

cycle_basis

Method
#
cycle_basis() -> tuple[list[Cycle], Subgraph]

Cycle basis of the full graph.

cycle_basis_of

Method
#
cycle_basis_of(subgraph: Subgraph) -> tuple[list[Cycle], Subgraph]

Cycle basis of a subgraph.

Parameters

NameTypeDefaultDescription
subgraphSubgraph

all_spanning_forests

Method
#
all_spanning_forests() -> list[Subgraph]

All spanning forests of the full graph.

all_spanning_forests_of

Method
#
all_spanning_forests_of(subgraph: Subgraph) -> list[Subgraph]

All spanning forests of a subgraph.

Parameters

NameTypeDefaultDescription
subgraphSubgraph

combine_to_single_hedgenode

Method
#
combine_to_single_hedgenode(nodes: Sequence[NodeIndex]) -> HedgeNode

Combine nodes into a single hedge node.

Parameters

NameTypeDefaultDescription
nodesSequence[NodeIndex]

all_cuts

Method
#
all_cuts(source: HedgeNode, target: HedgeNode) -> list[tuple[Subgraph, OrientedCut, Subgraph]]

All cuts between two hedge nodes.

Parameters

NameTypeDefaultDescription
sourceHedgeNode
targetHedgeNode

all_cuts_from_ids

Method
#
all_cuts_from_ids(source: Sequence[NodeIndex], target: Sequence[NodeIndex]) -> list[tuple[Subgraph, OrientedCut, Subgraph]]

All cuts between two sets of node indices.

Parameters

NameTypeDefaultDescription
sourceSequence[NodeIndex]
targetSequence[NodeIndex]

contract_subgraph

Method
#
contract_subgraph(subgraph: Subgraph, node_data_merge: Optional[DotVertexData] = None) -> None

Contract a subgraph into a single node, deleting its edges.

Parameters

NameTypeDefaultDescription
subgraphSubgraph
node_data_mergeOptional[DotVertexData]None

join

Method
#
join(other: DotGraph, matching_fn: Any, merge_fn: Any) -> DotGraph

Join two graphs, matching dangling edges via a Python callback.

Parameters

NameTypeDefaultDescription
otherDotGraph
matching_fnAny
merge_fnAny

join_mut

Method
#
join_mut(other: DotGraph, matching_fn: Any, merge_fn: Any) -> None

In-place join, matching dangling edges via a Python callback.

Parameters

NameTypeDefaultDescription
otherDotGraph
matching_fnAny
merge_fnAny

extract

Method
#
extract(subgraph: Subgraph, split_edge_fn: Any, internal_data: Any, split_node: Any, owned_node: Any) -> DotGraph

Extract a subgraph with Python callbacks to transform edge/node data.

Parameters

NameTypeDefaultDescription
subgraphSubgraph
split_edge_fnAny
internal_dataAny
split_nodeAny
owned_nodeAny

__getitem__

Method
#

Overloads

Overload 1 #
__getitem__(key: Hedge) -> DotHedgeData

No additional description is available for this overload.

Parameters
NameTypeDefaultDescription
keyHedge
Overload 2 #
__getitem__(key: NodeIndex) -> DotVertexData

No additional description is available for this overload.

Parameters
NameTypeDefaultDescription
keyNodeIndex
Overload 3 #
__getitem__(key: EdgeIndex) -> DotEdgeData

No additional description is available for this overload.

Parameters
NameTypeDefaultDescription
keyEdgeIndex