decomp.corpus.corpus

Module for defining abstract graph corpus readers

class decomp.corpus.corpus.Corpus(graphs_raw)

Container for graphs

Parameters

graphs_raw (Iterable[TypeVar(InGraph)]) – a sequence of graphs in a format that the graphbuilder for a subclass of this abstract class can process

property graphids: List[Hashable]

The graph ids in corpus

Return type

List[Hashable]

property graphs: Dict[Hashable, OutGraph]

the graphs in corpus

Return type

Dict[Hashable, TypeVar(OutGraph)]

items()

Dictionary-like iterator for (graphid, graph) pairs

Return type

Iterable[Tuple[Hashable, TypeVar(OutGraph)]]

property ngraphs: int

Number of graphs in corpus

Return type

int

sample(k)

Sample k graphs without replacement

Parameters

k (int) – the number of graphs to sample

Return type

Dict[Hashable, TypeVar(OutGraph)]