A threshold graph is a graph that is constructed by starting with an isolated vertex and iteratively adding another isolated vertex or a vertex that shares an edge with each vertex generated before it (the dominating vertices). The isolated vertices are represented by 0's and the dominating vertices are rerpresented by 1's. In this method, the initial vertex is implicit and by default is constructed, so the first entry need not always be 0 in the list.
i1 : L = {1,0,0,1,0,1} o1 = {1, 0, 0, 1, 0, 1} o1 : List |
i2 : thresholdGraph L o2 = Graph{0 => {1, 4, 6} } 1 => {0, 4, 6} 2 => {4, 6} 3 => {4, 6} 4 => {0, 1, 2, 3, 6} 5 => {6} 6 => {0, 1, 2, 3, 4, 5} o2 : Graph |
The object thresholdGraph is a method function.