Add graph examples in documentation
51
README.md
|
@ -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:
|
||||
|
|
|
@ -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
|
After Width: | Height: | Size: 10 KiB |
|
@ -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
|
After Width: | Height: | Size: 8.3 KiB |
|
@ -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
|
After Width: | Height: | Size: 8.3 KiB |
|
@ -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
|
After Width: | Height: | Size: 8.3 KiB |
|
@ -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
|
After Width: | Height: | Size: 10 KiB |
|
@ -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
|
After Width: | Height: | Size: 10 KiB |
|
@ -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
|
After Width: | Height: | Size: 9.5 KiB |
|
@ -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
|
After Width: | Height: | Size: 9.4 KiB |
|
@ -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
|
After Width: | Height: | Size: 10 KiB |