You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pygraph creates simple and quick Directed Graphs using relational sentences (knowledge base). It uses pydot for rendering the graphs.
The concept of this module is based on the ontological relationships, or Linked Data.
Means we don't need to create nodes then link them to one another separately,
but instead we will introduce new relations between nodes through statements, let's call them relation statements.
For example, the relation statement A likes B this will be translated into a graph (fig. below) with two nodes A and B where the link (edge)
between them is directed from A to B with the label likes.
How to use:
New relation statements can be introduced in two ways
module level by using add_relation('A likes B') method, or
from an external file where multiple relation statements can be parsed at once.
Or you can read relations directly from an external file and pass its path as an argument for pygraph/dgraph.py.
e.g.
file name kb-person.csv and its contents:
Man is-a Person
Woman is-a Person
Child is-a Person
Father has Child
Mother has Child
Mother is-a Wife
Father is-a Husband
Husband marriedTo Wife
Wife marriedTo Husband
Husband is-a Man
Wife is-a Woman