Graph
linnet_py Class
Graph(*, name: Optional[str] = None, global_data: Optional[GlobalData] = None, codec: Optional[DotCodec] = None, render_config: RenderConfig | None = None, node_store: NodeStore = NodeStore.Vec)An owned topology with arbitrary element data and typed rendering configuration.
Constructor
#Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | Optional[str] | None | — |
global_data | Optional[GlobalData] | None | — |
codec | Optional[DotCodec] | None | — |
render_config | RenderConfig | None | None | — |
node_store | NodeStore | NodeStore.Vec | — |
Member details
name
Property · read-onlyglobal_data
Property · read/writeglobal_data: GlobalDataNo description is available for this member.
Setter
global_data: GlobalDataParameters
| Name | Type | Default | Description |
|---|---|---|---|
value | GlobalData | — | — |
render_config
Property · read/writerender_config: RenderConfigNo description is available for this member.
Setter
render_config: RenderConfigParameters
| Name | Type | Default | Description |
|---|---|---|---|
value | RenderConfig | — | — |
n_nodes
Property · read-onlyn_edges
Property · read-onlyn_half_edges
Property · read-onlynode_store
Property · read-only__len__
Methodto_node_store
Methodnode
Methodedge
Methodhalf_edge
Methodnodes
Methodedges
Methodhalf_edges
Methodreorder_nodes
Methodreorder_nodes(order: Sequence[int]) -> NoneNo description is available for this member.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
order | Sequence[int] | — | — |
reorder_edges
Methodreorder_edges(order: Sequence[int]) -> NoneNo description is available for this member.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
order | Sequence[int] | — | — |
reverse_edge
Methodreverse_edge(key: int | str) -> NoneNo description is available for this member.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
key | int | str | — | — |
map
Methodfrom_dot
Class methodfrom_dot_set
Class methodfrom_dot_file
Class methodto_dot
Methodprepare_render
Methodprepare_render(*, config: RenderConfig | None = None) -> PreparedRenderStage one render so its exact Typst source and compiled output stay correlated.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
config | RenderConfig | None | None | — |
render
Methodrender(output: str | os.PathLike[str], *, config: RenderConfig | None = None) -> pathlib.PathNo description is available for this member.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
output | str | os.PathLike[str] | — | — |
config | RenderConfig | None | None | — |
to_svg
Methodto_svg(*, config: RenderConfig | None = None) -> strNo description is available for this member.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
config | RenderConfig | None | None | — |
_repr_svg_
Methodfull_subgraph
Methodempty_subgraph
Methodsubgraph
Methodsubgraph(*, nodes: Sequence[int | str] = ..., edges: Sequence[int | str] = ..., half_edges: Sequence[int] = ...) -> SubgraphNo description is available for this member.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
nodes | Sequence[int | str] | runtime default | — |
edges | Sequence[int | str] | runtime default | — |
half_edges | Sequence[int] | runtime default | — |
filter
Methodnodes_of
Methodedges_of
Methodhalf_edges_of
Methodinternal_boundary
Methodboundary
Methodexternal_half_edges
Methodconnected_components
Methodcount_connected_components
Methodis_connected
Methodcyclomatic_number
Methodis_reachable
Methodis_reachable(source: Node | int | str, target: Node | int | str, *, subgraph: Optional[Subgraph] = None, direction: DirectionBasis = DirectionBasis.Underlying) -> boolTest directed reachability within an optional structural selection.
Both endpoints must belong to the selected subgraph; otherwise this raises ValueError.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
source | Node | int | str | — | — |
target | Node | int | str | — | — |
subgraph | Optional[Subgraph] | None | — |
direction | DirectionBasis | DirectionBasis.Underlying | — |
topological_order
Methodtopological_order(*, subgraph: Optional[Subgraph] = None, direction: DirectionBasis = DirectionBasis.Underlying) -> list[Node]Return a deterministic topological order for the selected directed graph.
Explicitly selected zero-crown nodes appear first in ascending graph order.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
subgraph | Optional[Subgraph] | None | — |
direction | DirectionBasis | DirectionBasis.Underlying | — |
transitive_reduction
Methodtransitive_reduction(*, direction: DirectionBasis = DirectionBasis.Underlying) -> GraphReturn a new graph with directionally redundant DAG edges removed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
direction | DirectionBasis | DirectionBasis.Underlying | — |
depth_first_traverse
Methoddepth_first_traverse(root: int | str, *, subgraph: Optional[Subgraph] = None, include: Optional[int] = None) -> TraversalTreeNo description is available for this member.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
root | int | str | — | — |
subgraph | Optional[Subgraph] | None | — |
include | Optional[int] | None | — |
breadth_first_traverse
Methodbreadth_first_traverse(root: int | str, *, subgraph: Optional[Subgraph] = None, include: Optional[int] = None) -> TraversalTreeNo description is available for this member.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
root | int | str | — | — |
subgraph | Optional[Subgraph] | None | — |
include | Optional[int] | None | — |
bridges
Methodcycle_basis
Methodall_spanning_forests
Methodall_bonds
Methodall_bonds(*, subgraph: Optional[Subgraph] = None, min_size: Optional[int] = None, max_size: Optional[int] = None) -> list[Subgraph]Enumerate inclusion-minimal cutsets with an inclusive boundary-size range.
Bounds default to [1, unbounded]; min_size=0 is rejected because a bond is non-empty.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
subgraph | Optional[Subgraph] | None | — |
min_size | Optional[int] | None | — |
max_size | Optional[int] | None | — |
find_bond
Methodfind_bond(*, subgraph: Optional[Subgraph] = None, min_size: Optional[int] = None, max_size: Optional[int] = None) -> Optional[Subgraph]Find one native inclusion-minimal cutset within an inclusive size range.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
subgraph | Optional[Subgraph] | None | — |
min_size | Optional[int] | None | — |
max_size | Optional[int] | None | — |
all_cycles
Methodall_cycles(*, max_results: int, subgraph: Optional[Subgraph] = None) -> list[Cycle]Enumerate circuits only when the complete cycle-space candidate count fits the bound.
max_results bounds all non-empty combinations of a cycle basis, not only the combinations that ultimately form circuits.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
max_results | int | — | — |
subgraph | Optional[Subgraph] | None | — |
tadpoles
Methodall_cuts
Methodall_cuts(source: Sequence[int | str], target: Sequence[int | str]) -> list[CutPartition]Enumerate all native separating partitions between two disjoint, non-empty node groups.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
source | Sequence[int | str] | — | — |
target | Sequence[int | str] | — | — |
add_node
Methodadd_edge
Methodsplit_edge
Methodsplit_edge(at: _HalfEdgeTarget, replacement: EdgeValue, *, name: Optional[str] = None, orientation: Orientation = Orientation.Default) -> tuple[Edge, Edge]Parameters
| Name | Type | Default | Description |
|---|---|---|---|
at | _HalfEdgeTarget | — | — |
replacement | EdgeValue | — | — |
name | Optional[str] | None | — |
orientation | Orientation | Orientation.Default | — |
connect
Methodconnect(source: _HalfEdgeTarget, sink: _HalfEdgeTarget, replacement: EdgeValue, *, name: Optional[str] = None, orientation: Orientation = Orientation.Default) -> EdgeConnect two dangling half-edges; the first becomes the source endpoint.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
source | _HalfEdgeTarget | — | — |
sink | _HalfEdgeTarget | — | — |
replacement | EdgeValue | — | — |
name | Optional[str] | None | — |
orientation | Orientation | Orientation.Default | — |
concretize
Methodextract
Methoddelete
Methodcontract
Methodappend
Methodappend(other: Graph) -> GraphAppend another graph without matching dangling half-edges.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
other | Graph | — | — |
append_mut
Methodappend_mut(other: Graph) -> NoneAppend another graph in place without matching dangling half-edges.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
other | Graph | — | — |
join
Methodjoin_mut
Method__repr__
MethodView generated signature source: docs/api/python/linnet-py.pyi:448