`G = (:N, A, f:)`
`G = (:{1,2,3,4,5,6}, {a,b,c,d,e}, {(a, 2-3), (b, 1-4), (c, 4-5), (d, 1-3), (e, 2-2)}:)`
<diag> {"diag":{"width":"320","height":"240","elements":[{"text":{"center":{"x":238,"y":120},"text":"6","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":98,"y":153},"text":"5","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":22,"y":182},"text":"4","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":183,"y":174},"text":"3","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":192,"y":79},"text":"2","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":28,"y":31},"text":"1","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":175,"y":67}}},{"vertex":{"point":{"x":175,"y":152}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":33,"y":166}}},{"vertex":{"point":{"x":90,"y":143}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":31,"y":52}}},{"vertex":{"point":{"x":173,"y":154}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":30,"y":54}}},{"vertex":{"point":{"x":30,"y":165}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":185,"y":113},"text":"a","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":21,"y":100},"text":"b","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":62,"y":162},"text":"c","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":112,"y":92},"text":"d","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":150,"y":34},"text":"e","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":176,"y":46}}},"radius":20,"lineWidth":2,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":177,"y":68}}},"radius":5,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":233,"y":105}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":174,"y":156}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":89,"y":142}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":30,"y":167}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":29,"y":50}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}}]}}
</diag>
Tree - a graph that is connected and acyclic (including loops).
<diag> {"diag":{"width":"300","height":"200","elements":[{"text":{"center":{"x":127,"y":24},"text":"1","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":65,"y":47},"text":"2","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":20,"y":128},"text":"4","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":189,"y":54},"text":"3","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":67,"y":130},"text":"5","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":106,"y":130},"text":"6","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":148,"y":122},"text":"7","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":224,"y":118},"text":"8","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":177,"y":172},"text":"9","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":126,"y":40}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":66,"y":68}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":20,"y":111}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":175,"y":65}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":66,"y":112}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":105,"y":113}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":155,"y":111}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":207,"y":109}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":172,"y":154}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":127,"y":41}}},{"vertex":{"point":{"x":69,"y":68}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":128,"y":42}}},{"vertex":{"point":{"x":173,"y":63}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":65,"y":69}}},{"vertex":{"point":{"x":22,"y":110}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":66,"y":71}}},{"vertex":{"point":{"x":66,"y":111}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":69,"y":70}}},{"vertex":{"point":{"x":104,"y":112}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":176,"y":67}}},{"vertex":{"point":{"x":156,"y":110}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":176,"y":66}}},{"vertex":{"point":{"x":207,"y":109}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":155,"y":112}}},{"vertex":{"point":{"x":171,"y":153}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":96,"y":46},"text":"a","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":154,"y":44},"text":"b","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":38,"y":83},"text":"c","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":61,"y":96},"text":"d","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":95,"y":88},"text":"e","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":157,"y":86},"text":"f","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":198,"y":79},"text":"g","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":160,"y":140},"text":"h","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}}]}} </diag>
A binary tree is a tree where each node has at most two children.
<diag> {"diag":{"width":"250","height":"140","elements":[{"text":{"center":{"x":127,"y":24},"text":"1","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":26,"y":82},"text":"2","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":219,"y":88},"text":"3","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":126,"y":40}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":34,"y":97}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":205,"y":96}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":127,"y":41}}},{"vertex":{"point":{"x":34,"y":96}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":128,"y":42}}},{"vertex":{"point":{"x":204,"y":95}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":75,"y":60},"text":"a","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":177,"y":61},"text":"b","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":53,"y":113},"text":"left child","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":203,"y":111},"text":"right child","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}}]}} </diag>
A full binary tree is a binary tree where all internal nodes have two children and all leaves of the tree are at the same depth.
<diag> {"diag":{"width":"280","height":"140","elements":[{"text":{"center":{"x":127,"y":24},"text":"1","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":65,"y":47},"text":"2","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":31,"y":124},"text":"4","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":189,"y":54},"text":"3","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":97,"y":122},"text":"5","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":153,"y":124},"text":"6","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":220,"y":118},"text":"7","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":126,"y":40}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":66,"y":68}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":35,"y":111}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":175,"y":65}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":91,"y":111}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":152,"y":109}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"circle":{"center":{"vertex":{"point":{"x":207,"y":109}}},"radius":4,"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":127,"y":41}}},{"vertex":{"point":{"x":69,"y":68}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":128,"y":42}}},{"vertex":{"point":{"x":173,"y":63}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":65,"y":69}}},{"vertex":{"point":{"x":35,"y":109}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":69,"y":70}}},{"vertex":{"point":{"x":91,"y":111}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":176,"y":67}}},{"vertex":{"point":{"x":153,"y":109}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"line":{"vertices":[{"vertex":{"point":{"x":176,"y":66}}},{"vertex":{"point":{"x":207,"y":109}}}],"lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#ffffff","fontFace":"Ariel","fontHeight":20,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":96,"y":46},"text":"a","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":154,"y":44},"text":"b","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":38,"y":83},"text":"c","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":94,"y":83},"text":"d","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":156,"y":82},"text":"e","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}},{"text":{"center":{"x":196,"y":79},"text":"f","lineWidth":1,"lineStyle":"solid","lineColor":"#000000","fillColor":"#000000","fontFace":"Courier","fontHeight":10,"fontStyle":"normal","rotation":0}}]}} </diag>
Theorem - a tree with `n` nodes has `(n - 1)` arcs.
`G = (:N, A, f :)`
`G = (:{a, b, c}, {1, 2}, {(1, a-c), (2, c-b)}:)`
This graph is described as: the set of nodes, `a`, `b` and `c`; the set of arcs, `1` and `2`; arc `1` spans nodes `a` and `c`, arc `2` spans nodes `c` and `b`.
Directed graphs are identified by a function that associates an arc with an ordered pair of nodes.
`G = (:{a, b, c}, {1, 2}, {(1, (a, c)), (2, (c, b))}:)`
This graph is described as: the set of nodes, `a`, `b` and `c`; the set of arcs, `1` and `2`; arc `1` is directed from node `a` to node `c`, arc `2` is directed from node `c` to node `b`.
Attributes of this graph:
Parallel arcs - arcs that have the same initial node and same terminal node.
Complete graph - all distinct nodes are adjacent.
Connected graph - a path exists from any node to any other node.
Adjacency matrix - the number of arcs from one node to another node.
An adjacency matrix describes which nodes in a graph are adjacent to which other nodes.
`G = (:{a, b, c}, {1, 2}, {(1, a-b), (2, b-c)}:)`
Matrix dimensions are the number of rows by the number of columns.
E.g. 2 rows X 3 columns: `[(1, 0, 1),(0, 1, 1)]`
An adjacency matrix always has the same number of rows as columns.
The main diagonal runs from the upper left to lower right corners of the matrix. The main diagonal will always have 0's in each position unless the graph has a loop. A loop in the graph will be indicated by a 1 on the main diagonal.
For a symmetric matrix, each side of the main diagonal is a mirror image of the other.
An undirected graph always has a symmetric adjacency matrix.
`[(0, 0, 0),(0, 0, 0)]`
Identity Matrix - a matrix with all 1'a along the main diagonal with 0's in all other positions. An identity matrix must be square.
Identity matrix: `I = [(1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1)] 4 xx 4`
Not identity matrix: `[(1, 0, 0, 0), (0, 1, 0, 0)] 2 xx 4`
`I * A = A`
Matrix multiplication is NOT commutative. Order does make a difference.
`A * B != B * A`
`2 * [(a_(11), a_(12)), (a_(21), a_(22))] = [(2 * a_(11), 2 * a_(12)), (2 * a_(21), 2 * a_(22))]`
`A * B = C`
The number of columns in `A` must be the same as the number of rows in `B` to multiply.
`2xx3 * 3xx4 = 2xx4`
amath [(a_(11), a_(12)), (a_(21), a_(22))] * [(b_(11), b_(12)), (b_(21), b_(22))] = [(a_(11) * b_(11) + a_(12) * b_(21), a_(11) * b_(12) + a_(12) * b_(22)), (a_(21) * b_(11) + a_(22) * b_(21), a_(21) * b_(12) + a_(22) * b_(22))] = [(c_(11), c_(12)), (c_(21), c_(22))] endamath
Given the following graph:
`G = (:{a, b, c}, {1, 2}, {(1, a-b), (2, b-c)}:)`
`A * A = A^2 = [(0, 1, 0), (1, 0, 1), (0, 1, 0)] * [(0, 1, 0), (1, 0, 1), (0, 1, 0)] = [(0*0+1*1+0*0, 0*1+1*0+0*1, 0*0+1*1+0*0),(1*0+0*1+1*0, 1*1+0*0+1*1, 1*0+0*1+1*0), (0*0+1*1+0*0, 0*1+1*0+0*1, 0*0+1*1+0*0)] = [(1, 0, 1), (0, 2, 0), (1, 0, 1)]`
`A` represents the number of paths of length 1.
`A^2` represents the number of paths of length 2. There is one path of length 2 from node `a` to node `a`. The path traverses from node `a` to node `b` then back to node `a`.
`A^n` represents the number of paths of length `n` between any two nodes.
In determining the value of `n`, consider the number of distinct nodes - 1 (not including isolated nodes).
`R = A + A^2 + A^3 + … + A^n`
`R` - The number of paths `\le` length `n`