Skip to content

Commit

Permalink
Add graph examples in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dtamai committed Oct 1, 2019
1 parent cebffca commit 27c0d12
Show file tree
Hide file tree
Showing 19 changed files with 168 additions and 0 deletions.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,57 @@ There are also instance methods to determine the relationship between 2 nodes:
|`descendant_of?(node)` | node is one of this record's ancestors|
|`indirect_of?(node)` | node is one of this record's ancestors but not a parent|

## Visual guide for navigation

In all examples the node with the large border is the reference node, the node
from witch the navigation method is invoked. The yellow nodes are the nodes
returned by the method.

<table>
<tr>
<td>
<p align="center">parent</p>
<img src="img/parent.png" alt="parent"/>
</td>
<td>
<p align="center">root</p>
<img src="img/root.png" alt="root"/>
</td>
<td>
<p align="center">ancestors</p>
<img src="img/ancestors.png" alt="ancestors"/>
</td>
</tr>
<tr>
<td>
<p align="center">path</p>
<img src="img/path.png" alt="path"/>
</td>
<td>
<p align="center">children</p>
<img src="img/children.png" alt="children"/>
</td>
<td>
<p align="center">siblings</p>
<img src="img/siblings.png" alt="siblings"/>
</td>
</tr>
<tr>
<td>
<p align="center">descendants</p>
<img src="img/descendants.png" alt="descendants"/>
</td>
<td>
<p align="center">indirects</p>
<img src="img/indirects.png" alt="indirects"/>
</td>
<td>
<p align="center">subtree</p>
<img src="img/subtree.png" alt="subtree"/>
</td>
</tr>
</table>

# Options for `has_ancestry`

The has_ancestry method supports the following options:
Expand Down
13 changes: 13 additions & 0 deletions img/ancestors.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
graph TD
A((A)) --- B((B))
A --- C((C))
A --- D((D))
B --- E((E))
C --- F((F))
C --- G((G))

classDef reference stroke:#134,stroke-width:10px
classDef selected fill:#fd7

class E reference
class A,B selected
Binary file added img/ancestors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions img/children.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
graph TD
A((A)) --- B((B))
A --- C((C))
A --- D((D))
B --- E((E))
C --- F((F))
C --- G((G))

classDef reference stroke:#134,stroke-width:10px
classDef selected fill:#fd7

class A reference
class B,C,D selected
Binary file added img/children.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions img/descendants.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
graph TD
A((A)) --- B((B))
A --- C((C))
A --- D((D))
B --- E((E))
C --- F((F))
C --- G((G))

classDef reference stroke:#134,stroke-width:10px
classDef selected fill:#fd7

class A reference
class B,C,D,E,F,G selected
Binary file added img/descendants.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions img/indirects.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
graph TD
A((A)) --- B((B))
A --- C((C))
A --- D((D))
B --- E((E))
C --- F((F))
C --- G((G))

classDef reference stroke:#134,stroke-width:10px
classDef selected fill:#fd7

class A reference
class E,F,G selected
Binary file added img/indirects.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions img/parent.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
graph TD
A((A)) --- B((B))
A --- C((C))
A --- D((D))
B --- E((E))
C --- F((F))
C --- G((G))

classDef reference stroke:#134,stroke-width:10px
classDef selected fill:#fd7

class E reference
class B selected
Binary file added img/parent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions img/path.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
graph TD
A((A)) --- B((B))
A --- C((C))
A --- D((D))
B --- E((E))
C --- F((F))
C --- G((G))

classDef reference stroke:#134,stroke-width:10px
classDef selected fill:#fd7

class E reference
class A,B,E selected
Binary file added img/path.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions img/root.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
graph TD
A((A)) --- B((B))
A --- C((C))
A --- D((D))
B --- E((E))
C --- F((F))
C --- G((G))

classDef reference stroke:#134,stroke-width:10px
classDef selected fill:#fd7

class E reference
class A selected
Binary file added img/root.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions img/siblings.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
graph TD
A((A)) --- B((B))
A --- C((C))
A --- D((D))
B --- E((E))
C --- F((F))
C --- G((G))

classDef reference stroke:#134,stroke-width:10px
classDef selected fill:#fd7

class C reference
class B,C,D selected
Binary file added img/siblings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions img/subtree.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
graph TD
A((A)) --- B((B))
A --- C((C))
A --- D((D))
B --- E((E))
C --- F((F))
C --- G((G))

classDef reference stroke:#134,stroke-width:10px
classDef selected fill:#fd7

class C reference
class C,F,G selected
Binary file added img/subtree.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 27c0d12

Please sign in to comment.