On this page

Subgraph

linnet_py Class

Subgraph()

Subgraph represented as a bitset of hedges.

Member details

empty

Class method
#
empty(size: int) -> Subgraph

Create an empty subgraph of the given size (number of hedges).

Parameters

NameTypeDefaultDescription
sizeint

full

Class method
#
full(size: int) -> Subgraph

Create a full subgraph including all hedges.

Parameters

NameTypeDefaultDescription
sizeint

from_hedges

Class method
#
from_hedges(size: int, hedges: Sequence[Hedge]) -> Subgraph

Create a subgraph from a list of hedges.

Parameters

NameTypeDefaultDescription
sizeint
hedgesSequence[Hedge]

to_hedges

Method
#
to_hedges() -> list[Hedge]

List included hedges.

size

Method
#
size() -> int

Total number of hedges in the parent graph.

n_included

Method
#
n_included() -> int

Number of included hedges.

includes

Method
#
includes(hedge: Any) -> bool

Whether a hedge is included.

Parameters

NameTypeDefaultDescription
hedgeAny

union

Method
#
union(other: Subgraph) -> Subgraph

Union with another subgraph.

Parameters

NameTypeDefaultDescription
otherSubgraph

intersection

Method
#
intersection(other: Subgraph) -> Subgraph

Intersection with another subgraph.

Parameters

NameTypeDefaultDescription
otherSubgraph

sym_diff

Method
#
sym_diff(other: Subgraph) -> Subgraph

Symmetric difference with another subgraph.

Parameters

NameTypeDefaultDescription
otherSubgraph

subtract

Method
#
subtract(other: Subgraph) -> Subgraph

Subtract another subgraph.

Parameters

NameTypeDefaultDescription
otherSubgraph

__repr__

Method
#
__repr__() -> str

Debug-style representation.