clingo#
a2edgetuple#
c2edgepairs#
clingo2num#
clingo_preamble#
clingo_wedge#
- gunfolds.conversions.clingo_wedge(x, y, w, n, name='edge')[source]#
Returns
clingo
predicate for weighted edge- Parameters:
x (integer) – outgoing edge
y (integer) – incoming edge
w (integer) – weight
n (integer) – number of nodes
name (string) – name of the variable for
clingo
- Returns:
clingo
predicate for weighted edge- Return type:
string
drasl_jclingo2g#
encode_list_sccs#
- gunfolds.conversions.encode_list_sccs(glist, scc_members=None)[source]#
Encodes strongly connected components of a list of
gunfolds
graph toclingo
predicates- Parameters:
glist (list of dictionaries (
gunfolds
graphs)) – a list of graphs that are under sampled versions of the same systemscc_members (list) – a list of dictionaries for nodes in each SCC
- Returns:
clingo
predicates- Return type:
string
encode_sccs#
- gunfolds.conversions.encode_sccs(g, idx, components=True, SCCS=None)[source]#
Encodes strongly connected components of
gunfolds
graph toclingo
predicates- Parameters:
g (dictionary (
gunfolds
graphs)) –gunfolds
graphidx (integer) – index of the graph
components (boolean) – If True, encodes SCC components and memberships to
clingo
predicatesSCCS (list) – SCC membership of nodes
- Returns:
clingo
predicates- Return type:
string
g2clingo#
- gunfolds.conversions.g2clingo(g, directed='hdirected', bidirected='hbidirected', both_bidirected=False, preamble=True)[source]#
Convert a graph to a string of grounded terms for clingo
- Parameters:
g (dictionary (
gunfolds
graphs)) –gunfolds
graphdirected (string) – name of the variable for directed edges in the observed graph
bidirected (string) – name of the variable for bidirected edges in the observed graph
both_bidirected (boolean) – (Ask)
preamble (boolean) – (Ask)
- Returns:
clingo
predicate- Return type:
string
Example: {1:{3:1,4:2,5:3}} "1": node 1 has an edge with node 3 => edge(1,3). "2": node 1 has an conf with node 4 => conf(1,4). "3": node 1 has both edge and conf with node 5 => edge(1,5). conf(1,5).
g2wclingo#
msl_jclingo2g#
numbered_g2clingo#
- gunfolds.conversions.numbered_g2clingo(g, n, directed='hdirected', bidirected='hbidirected')[source]#
Convert a graph to a string of grounded terms for clingo
- Parameters:
g (dictionary (
gunfolds
graphs)) –gunfolds
graphn (integer) – number of nodes
directed (string) – name of the variable for directed edges in the observed graph
bidirected (string) – name of the variable for bidirected edges in the observed graph
- Returns:
clingo
predicate- Return type:
string
Example: {1:{3:1,4:2,5:3}} "1": node 1 has an edge with node 3 => edge(1,3). "2": node 1 has an conf with node 4 => conf(1,4). "3": node 1 has both edge and conf with node 5 => edge(1,5). conf(1,5).
numbered_g2wclingo#
- gunfolds.conversions.numbered_g2wclingo(g, num, directed_weights_matrix=None, bidirected_weights_matrix=None, directed='hdirected', bidirected='hbidirected')[source]#
Convert a graph to a string of grounded terms for
clingo
- Parameters:
g (dictionary (
gunfolds
graphs)) –gunfolds
graphnum (integer) – index of the graph in the resulting clingo command
directed_weights_matrix (numpy matrices) – directed weight matrix
bidirected_weights_matrix (numpy matrices) – bidirected weight matrix
directed (string) – name of the directed edges in the observed graph
bidirected (string) – name of the bidirected edges in the observed graph
- Returns:
clingo
predicate- Return type:
string