Graph¶
its all a graph maaaaaannnnnn
Classes:
Functions:
|
|
|
-
class
recurse_words.graph.
Graph
(recurser: recurse_words.recursers.graph.Graph_Recurser)¶ Bases:
object
Represent and manipulate a
Recurser
object as a graph!- Variables
filtered_edges (
pandas.DataFrame
) – Edges after some call toGraph.filter()
, initialized asGraph.edges
.
Methods:
_translate_edges
(edges)_sort_edges
(edges)Sort edges in order of source, subword, replacement, target
filter
(root_word[, depth])Filter the graph from some root word and depth
Attributes:
Pandas dataframe of all edges, in columns:
Precurser to
Graph.edges
, gets edges before they’re translated back to human-readable.Edges after being filtered by
Graph.filter()
-
_translate_edges
(edges: pandas.core.frame.DataFrame) → pandas.core.frame.DataFrame¶
-
_sort_edges
(edges: pandas.core.frame.DataFrame) → pandas.core.frame.DataFrame¶ Sort edges in order of source, subword, replacement, target
-
property
edges
¶ Pandas dataframe of all edges, in columns:
('source', 'subword', 'replacement', 'target')
If corpus has a translation layer, edges should be the translated version of the edges.
- Returns
pandas.DataFrame
-
property
untranslated_edges
¶ Precurser to
Graph.edges
, gets edges before they’re translated back to human-readable.Equivalent to edges if there is no translation layer
- Returns
pandas.DataFrame
-
property
filtered_edges
¶ Edges after being filtered by
Graph.filter()
Until then, equivalent to
Graph.edges
- Should be used by all graph generating mechanisms rather than
Graph.edges
, which is intended to be the immutable source of edges.
- Returns
pandas.DataFrame
-
filter
(root_word: str, depth: int = 0) → pandas.core.frame.DataFrame¶ Filter the graph from some root word and depth
Note that this words off the original, untranslated edges to avoid any loss of meaning that might happen in the mapping from the network edge space to the human-readable space, eg. in the
corpi.CMUDict
phonetic corpus, multiple english words map to a single phonetic representation, so when translated back to english one is chosen at random. Filtering in the network space avoids the ambiguity, hopefully.- Parameters
root_word (str) – Root word to
depth (int) – number of additional steps to take. 0 returns just the words immediately connected to the root word.
- Returns
pandas.DataFrame
-
make_datashader
()¶
-
recurse_words.graph.
datashader_network
(recurser: recurse_words.recursers.graph.Graph_Recurser, root_word: Optional[str] = None, depth: int = 0, res=(10000, 10000), cmap_min=65)¶
-
recurse_words.graph.
draw_labels
(stack, net_layout)¶