Skip to content

md-py/md.python.graph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

md.python.graph

md.python.graph component defines contracts to perform operations over graph type, and provides few useful tools out from box.

Architecture overview

Architecture overview

Component overview

# Types
NodeType = typing.TypeVar('NodeType', bound=typing.Hashable)
GraphType = typing.Mapping[NodeType, typing.Collection[NodeType]]
GraphPathType = typing.Iterable[NodeType]
TopologicalSortType = typing.Callable[[GraphType[NodeType]], typing.Iterable[NodeType]]

# Implementation 
def topological_sort_ascending(graph: GraphType[NodeType]) -> typing.Iterable[NodeType]: ...

def topological_sort_descending(
    graph: GraphType[NodeType],
    initial_node: typing.Iterable[NodeType] = None
) -> typing.Iterable[NodeType]: ...

def get_paths(graph: GraphType[NodeType], include_subtree: bool = False) -> typing.Tuple[
    typing.List[GraphPathType[NodeType]],
    typing.List[GraphPathType[NodeType]],
]: ...

Install

pip install md.python.graph --index-url https://source.md.land/python/

Read documentation with examples: https://development.md.land/python/md.python.graph/

About

Set of contracts & operations over graph type

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages