A separator-based method for generating weakly chordal graphs

05/08/2019 ∙ by Md. Zamilur Rahman, et al. ∙ 0

We propose a scheme for generating a weakly chordal graph on n vertices with m edges. In this method, we first construct a tree and then generate an orthogonal layout (which is a weakly chordal graph on the n vertices) based on this tree. In the next and final step, we insert additional edges to give us a weakly chordal graph on m edges. Our algorithm ensures that the graph remains weakly chordal after each edge is inserted. The time complexity of an insertion query is O(n^3) time and an insertion takes constant time. On the other hand, a generation algorithm based on finding a 2-pair takes O(nm) time using the algorithm of Arikati and Rangan [1].

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

In this paper will be used to denote a graph with vertices and edges. is chordal if it has no chordless cycles of size four or more. However, as the following example shows (Figure 1), its complement can contain chordless 4-cycles.

(a)
(b)
Figure 1: Complement of a chordal graph with a chordless 4-cycle

This suggested the generalization of chordal graphs to weakly chordal (or weakly triangulated) graphs as those graphs such that neither nor its complement contains chordless cycles of size five or greater [3]. From the symmetry of the definition it follows that is also weakly chordal. Figure 2 shows an example of a weakly chordal graph () along with its complement ().

(a)
(b)
Figure 2: Weakly chordal graph

In this paper we address the algorithmic problem of generating weakly chordal graphs. While the problem of generating graphs uniformly at random has received much attention (see [11][12][13][7]), little is known about this problem. There are many situations where we would like to generate instances of these to test algorithms for weakly chordal graphs. For instance, in [8] the authors generate all linear layouts of weakly chordal graphs. A generation mechanism can be used to provide input instances for this algorithm.

An edge in is peripheral if it is not the middle edge of a chordless path spanning four vertices of . In [4], Hayward proposed the following constructive characterization of weakly chordal graphs, based on the notion of a peripheral edge.

Theorem 1.1

[4] A graph is weakly chordal if and only if it can be generated in the following manner:

  1. Start with an empty graph .

  2. Repeatedly add an edge to the graph to create the graph such that is a peripheral edge of .

This is analogous to a similar characterization for chordal graphs by Fulkerson and Gross [2]. No details were provided as to how to decide if an edge is peripheral and the complexity of the generation method. The proof of this theorem uses the notion of a two-pair and a generation method can be devised based on this. A pair of vertices in is a two-pair if the only chordless paths between the and are of length 2. Interestingly enough, a weakly chordal graph that is not a clique has a two-pair [5]. Furthermore, let be a two-pair in an arbitrary graph . Then is weakly chordal iff is weakly chordal [10]. We can then generate a weakly chordal graph on vertices by starting with a tree (which trivially satisfies the definition of weak chordality) and repeatedly find a two-pair and add to the edge joining to . To find a two-pair we can use an algorithm due to Arikati and Rangan [1]. Unfortunately, this does not allow us to exploit the structural properties of a weakly chordal graph.

Thus in this paper we propose a separator-based strategy that generalizes an algorithm due to Markenzon [6] for generating chordal graphs and allows us to exploit the structural properties of a weakly triangulated graph.

The paper is organized thus. In the next section, we collect in one place some common graph-theoretic terminology used throughout the paper and also add a brief review of Markenzon’s incremental method [6] for generating chordal graphs. The following section contains details of our algorithm, beginning with a brief overview. The final section contains some concluding remarks and suggestions for further research.

1.1 Preliminaries

For a given , let and . The neighborhood of a vertex is denoted as where . The closed neighborhood of a vertex , denoted by is . The complement of a graph , denoted by , contains the same set of vertices such that two vertices of are adjacent iff they are not adjacent in . The graph in Fig 2(b) is the complement of the graph (Fig 2(a)).

For any vertex set , the edge set is defined to be . Let denote the subgraph of induced by , namely the subgraph . In other words, an induced subgraph is a subset of the vertices of a graph together with any edges whose endpoints are both in this subset.

A path in a graph is a sequence of vertices , where for , is an edge of . The first vertex is known as the start vertex, the last vertex is called the end vertex, and the remaining vertices in the path are known as internal vertices. A cycle is a closed path where the start vertex and the end vertex coincide. The size of a cycle is the number of edges in it. A clique in is a subset of vertices of such that the induced subgraph is complete. A maximal clique is a clique that cannot be extended by including one more adjacent vertex. A graph on vertices that forms a clique on vertices is called a complete graph ().

Based on the given and , Markenzon’s method starts by generating a labeled tree on vertices using Prüfer’s scheme [9]. Next, an edge is inserted in each iteration to reach . The algorithm picks a pair of vertices and checks whether is reachable from on the induced graph , where and . If is connected, then a path exists between and and thus is not chordal; otherwise, the augmented graph is chordal. To make the search for a path efficient, the method reduces the set from to , for any . The correctness of the algorithm was established by proving the following theorem.

Theorem 1.2

[6] Let be a connected chordal graph and . The augmented graph is chordal if and only if is not connected.

2 Generation of Weakly Chordal Graphs

2.1 Overview of the Method

Just as in Markenzon’s incremental method for chordal graphs, we take as input the number of vertices, , and the number of edges, , of the weakly chordal graph to be generated. Our proposed method starts with generating a tree. With the help of a tree, we construct an orthogonal layout made up of 4-cycles, each cycle corresponding to a node of this tree. We then insert additional edges into this initial layout to ensure that the final graph has edges. Trees are weakly chordal graphs and so is the initial orthogonal layout of the 4-cycles. Additional edges are introduced to reach the target value of by picking a pair of vertices and at random and checking if the augmented graph remains weakly chordal.

If and have some common neighbors (), we remove those common neighbors and check whether the removal of the common neighbors separates and , leaving them in different components. We create an induced graph on a set of vertices called that contain the neighbors of neighbors of to check whether and are in different components. If so we insert an edge between and , else we search for shortest paths between and . We do not insert the edge if the length of the shortest path is greater than . Otherwise, we have to check for other conditions, such as single or multiple ( denotes a path of length 3), forbidden configurations, alternate longer paths between and to decide whether the insertion of preserves weak chordality.

If there are no common neighbors () between and , we apply the same rules to this case as when does not separate and (as explained in the previous paragraph). The only difference is that here we have to consider the entire graph to search for shortest paths between and but the other subsequent steps remain the same. All the phases of this generation method are explained in full details in the next subsections.

2.2 Phase 1: Generation of Tree

We generate a tree, , on nodes that each node is of degree-4 at most as follows. Starting with a single node, we add new ones either by splitting an edge into two or joining a new node to one of the existing nodes, chosen at random. After nodes, have been added, we traverse the tree to check for adjacent degree-4 nodes. If such a pair is found, we separate them by introducing a new node adjacent to both. We define as the number of nodes in the tree ().

2.3 Phase 2: Generation of Initial Layout

In this phase, we generate an orthogonal initial layout of . For each node in , we create a four-cycle. Figure 3(a) shows a tree with two nodes, and . For node in the tree, we generate a four-cycle and for node we generate another four-cycle adjacent to the existing four-cycle because node is adjacent to node in the tree. The corresponding layout is shown in Figure 3(b). We define this as the initial layout. For the example tree of Figure 3(c), the corresponding initial layout is shown in Figure 3(d).

(a) Tree ()
(b) Initial Layout ()
(c) Tree ()
(d) Initial Layout ()
(e) Tree ()
(f) Tree ()
(g) Initial Layout ()
Figure 3: Tree to layout (four-cycles)

As explained in the first phase, after generating a tree, if two degree- nodes are adjacent, we insert a new node between them to separate them (see Figure 3(e)LABEL:, and LABEL:). Since a four-cycle has only four sides, two degree- nodes cannot be adjacent. As we are interested in generating proper weakly chordal graphs (and not just chordal graphs), we want to have four-cycles in the initial layout. At this point, if the orthogonal layout has more than vertices, we delete vertices from four cycles to make it equal to . To delete a vertex, we select vertices having degree at most two. If the number of edges in the initial layout is greater than or equal to the given , the algorithm stops and returns the layout as a weakly chordal graph. Otherwise, it takes the difference of the number of edges and inserts that many edges in the initial layout to produce a weakly chordal graph. Now we denote the number of edges as in the initial orthogonal layout.

2.4 Phase 3: Generation of Weakly Chordal Graph

After generating an initial layout, we insert edges to generate weakly chordal graphs. We divide the insertion of an edge into two cases. The first case considers when is non-empty and the second case is when is empty, where , represents the set of common neighbors between and . Let’s discuss the case first when is non-empty.

2.4.1 Case 1: is non-empty

Since is non-empty, we need to check whether the removal of separates and . To do this, we create an induced graph, called on the set of vertices . Now we perform a breadth-first search on , starting at and if has not been reached, then the augmented graph is weakly chordal. Thus we can insert an edge in the weakly chordal graph because the removal of their common neighbors () in leaves and in different components. Instead of searching for a path on this large set of vertices, we consider an induced graph on a smaller subset of vertices. In [6], the authors built the induced graph on the neighbors of any vertex in for the chordal graph. But here we need to consider the neighbors of neighbors of every vertex in to explore paths between and . Formally the set of vertices included in can be defined as .

Consider the graph shown in Figure 4. We want to introduce an edge between and which is not allowed because the insertion violates the property of the weakly chordal graph. There is only one common neighbor between and . The is and the induced graph on shows there is no path between and but there are longer paths ( and ) exist between and . These paths are discoverable if we take the neighbors of neighbors of and build on as defined above. The includes and thus the comprises .

Figure 4: Why neighbors of neighbors?

This is the first part of case 1 that we define as case 1.1. This idea is extended from [6], where the authors insert an edge in a chordal graph when has not been reached from during a breadth-first search on . What happens if is reachable from in a weakly chordal graph?

In a weakly chordal graph we may be able to insert an edge even when a path exists between and . In a chordal graph, the separators are cliques but in a weakly chordal graph, the separators may not necessarily cliques. Now we have to explore all the shortest paths of length 3 or more between and . If there is a path longer than exists, we do not insert and choose another pair of vertices, otherwise, we check the other conditions for the possibility of insertion of . We call this case 1.2. Again we divide this case 1.2 into two subcases: if there is a single then we called case 1.2.1 and otherwise case 1.2.2 for multiple .

Case 1.2.1: We find the neighbors of the shortest path. If the neighborhood of the shortest path is empty, we insert an edge , otherwise, we find the alternate paths in the entire graph. Instead of searching for alternate paths in the entire graph, we search for alternate paths on different induced graphs created on (where represents the shortest path between and ) by removing both the internal vertices of or exactly one of them to find alternate paths between and . Consider the two situations shown in Figure 5 where is a path of length . In Figure 5(a), each vertex on , is a neighbor of either or but in Figure 5(b) there exists a vertex () which is neither a neighbor of nor . Thus we are interested in the neighbors of neighbors of the shortest path to discover other alternate paths.

(a)
(b)
Figure 5: Neighbors of a path

The alternate paths may exist via some of the vertices in the shortest path and/or other vertices including in the neighbors or the neighbors of neighbors of the shortest path or disjoint path via the vertices not included in . If no alternate paths exist, we can insert an edge , otherwise we do not insert and choose another pair of vertices. The algorithm 1 explains the Case 1.2.1 (for a single shortest path).

1:Single shortest path (, , )
2:for each in  do
3:     Compute
4:end for
5:if   then
6:     Insert edge
7:else
8:     for each in  do
9:         Compute
10:     end for
11:     Create different induced graphs on by removing both the internal vertices of or exactly one of them
12:     Check for alternate longer path between and
13:     if no alternate longer path exists then
14:         Insert edge
15:     end if
16:end if
Algorithm 1 SingleShortestPathSubCase

Case 1.2.2: In the case of multiple shortest paths, first we need to check for forbidden configurations. To define a forbidden configuration, let’s consider the graphs shown in Figure 6. In Figure 6(a), we can insert an edge because it does not create any chordless five cycles or more in the graph , but it creates a chordless six cycle in the complement graph as illustrated in Figure 6(b). As we know from the definition of the weakly chordal graph, a graph is weakly chordal if neither nor its complement contains a chordless cycle of size or more. But creates a chordless six cycle in . Thus, we cannot add in . The forbidden configuration checking is required when two or more shortest paths exist between and and the checking has to be done by considering all pairwise disjoint shortest paths. Figure 7 illustrates other configurations where adding to may be allowed.

(a)
(b)
Figure 6: Forbidden configuration
(a)
(b)
(c)
(d)
(e)
(f)
(g)
Figure 7: Other allowed configurations
(a) Disjoint path
(b) Shared path
Figure 8: Different paths between and

After checking forbidden configurations, the next step is to check for alternate longer paths between and . Like case 1.2.1, instead of searching for alternate longer paths in the entire graph we do the search on the different induced graphs created on (where represents all the shortest paths between and containing the set of vertices in the paths including two endpoints) by removing all the internal vertices of or exactly one of them to find alternate paths between and . The alternate paths may exist via some of the vertices in the shortest path and/or the other vertices including in the neighbors/the neighbors of neighbors of the shortest path or disjoint path via the vertices not included in . These two scenarios are illustrated in Figure 8.

1:Multiple shortest paths (, , )
2:if no forbidden configuration then
3:     for each SP do
4:         for each in  do
5:              Compute
6:         end for
7:     end for
8:     for each in  do
9:         Compute
10:     end for
11:     Create different induced graphs on by removing both the internal vertices of or exactly one of them
12:     Check for alternate longer path between and
13:     if no alternate longer path exists then
14:         Insert edge
15:     end if
16:end if
Algorithm 2 MultipleShortestPathSubCase
1:An initial layout
2:A weakly chordal graph
3:; is the no. of edges in the initial layout
4:while   do
5:     Choose a pair of vertices and
6:     if  exists then
7:         continue
8:     else
9:         Compute and
10:         Compute
11:         if  is non-empty then case 1:
12:              for each in  do
13:                  Compute
14:              end for
15:              for each in  do
16:                  Compute
17:              end for
18:              Create on
19:              Find whether there is a path exist between and in
20:              if  is not reachable from  then case 1.1
21:                  Insert edge
22:              else if Find all the shortest paths between and  then case 1.2
23:                  if all shortest paths are of length 3 (then
24:                       if there is a single shortest path between and  then case 1.2.1
25:                           call singleShortestPathSubCase
26:                       else if there are multiple shortest paths between and  then case 1.2.2
27:                           call multipleShortestPathsSubCase
28:                       end if
29:                  end if
30:              end if
31:         else case 2:
32:              if all shortest paths are of length 3 (then
33:                  if there is a single shortest path between and  then case 2.1
34:                       call singleShortestPathSubCase
35:                  else if there are multiple shortest paths between and  then case 2.2
36:                       call multipleShortestPathsSubCase
37:                  end if
38:              end if
39:         end if
40:     end if
41:end while
Algorithm 3 FromInitLayoutToWCG

2.4.2 Case 2: is empty

In this case, there are no common neighbors of and but a path exists between and . This case can be solved in a similar way as for case 1.2. Here the is the entire graph because is empty. If any of the paths is greater than , we do not insert and choose another pair of vertices. Otherwise, we apply the same single shortest path case 1.2.1 and multiple shortest path case 1.2.2 to check if the addition of keeps the graph weakly chordal or not. Here we define the single shortest path case as case 2.1 and multiple shortest paths case as case 2.2. The details of all the above cases are formally described in algorithm 3.

2.4.3 An Example

Figure 9 shows an example for the generation of weakly chordal graph for and . All the phases are shown in Figure 9. Figure 9(a) shows the tree on nodes. There are three nodes in the tree and for each node in the tree, we create an orthogonal initial layout which is shown in Figure 9(b) where and . We assign the labels of vertices as in the initial layout. We need to insert more edges in the initial layout to generate a weakly chordal graph for the given input.

Assume we want to insert edge . The insertion of an edge between and falls into the case where is non-empty. Since the removal of leaves vertices and in two different components, so we can insert an edge between vertices and according to case 1.1 as shown in Figure 9(c). Now we want to insert edge . The insertion of an edge between and falls into the case 1.2.1 because the removal of their common neighbor does not separate and . The is and the is . Now we create the on the and then we search for the paths from to . There is a single shortest path exist that means it falls into case 1.2.1. We compute and the , so we need to compute which is and create induced graph on these set of vertices. To discover disjoint or shared alternate paths from to we create different induced graphs by removing some vertices from the above-computed set of vertices. But there is no such path exists and we can insert an edge between and .

(a) Tree ()
(b) Initial Layout ()
(c) WCG()
(d) WCG()
Figure 9: Tree to weakly chordal graph

2.5 Time Complexity

The tree generation is the first phase in the proposed approach and can be constructed in time where is the number of nodes in a tree. For nodes in the tree, we insert edges in the layout and each edge insertion can be done in constant time. So the initial layout can be generated in time.

In the third phase, the pair of vertices is chosen at random to insert an edge between them. Two types of failures may arise. One is that the pair of vertices corresponds to an existent edge and the other is the addition of violates weak chordality property. To avoid the first type of failures either we can maintain a list of edges (those are present in the complement graph) not present in the current graph or we can check the existence of an edge in constant time by maintaining the adjacency matrix representation of the current graph.

Computing the neighborhood of a vertex takes linear time. Thus step 7 takes linear time. By amortizing over the edges we can see that step 8 takes linear time in the number of edges and the number of vertices . Thus each of the neighborhood computations take linear time. The can be created in linear time on the number of vertices in the . Using breadth-first search (BFS), we find whether there is a path exist between and in linear time. To find all shortest paths we also use BFS by keeping track of all predecessors between and . All the operations including neighborhood computations, induced graph creations, and finding alternate longer paths take linear time (see step 23 and step 32).

For steps 25 and 34, the forbidden configuration checking is required when two or more shortest paths exist between and and the checking has to be done by considering all pairwise disjoint shortest paths. The checking is performed by the presence of one of the cross edges (an edge from one of the internal nodes from one shortest path to the alternate internal node of another shortest path) on the induced graph on a pair of disjoint shortest paths. There are at most pairs of mutually disjoint paths between and and thus the step takes time (see Appendix). We use BFS to find an alternate longer path between and . Since there are at most multiple paths between and and thus in total we spend time. In the worst case, an insertion query runs in time.

The insertion of is performed in time because we need to insert in the neighborhood of and in the neighborhood of .

3 Conclusions

We have proposed a method for the generation of weakly chordal graphs. We have implemented the proposed algorithm in Python. An interesting open problem is to investigate how to generate weakly chordal graphs uniformly at random. This requires coming up with a scheme for counting the number of labeled weakly chordal graphs on vertices having

edges. If we could also determine the probability distribution underlying our algorithm for generating weakly chordal graphs, then we could compute the relative entropy between the two distributions to estimate how close our algorithm is to generating weakly chordal graphs uniformly at random.

4 Appendix

We are interested in finding all shortest paths between and (see Figure 10). Suppose there are vertices in the graph. Let be the set of vertices adjacent to that lie on the shortest paths between and . Likewise, let be the set of vertices adjacent to that lie on these shortest paths. Thus is the upper bound of the number of paths between and . Since , then .

Let be the degree of relative to the vertices , for . Then the number of pairs of edge-disjoint paths between and is given by . Let . Now it follows from the equality that is maximum when all ’s are equal. Therefore an upperbound on is . Since , we have .

Figure 10: paths between and

References

  • [1] Srinivasa Rao Arikati and C. Pandu Rangan. An efficient algorithm for finding a two-pair, and its applications. Discrete Applied Mathematics, 31(1):71–74, 1991.
  • [2] D. R. Fulkerson and O. A. Gross. Incidence matrices and interval graphs. Pacific J. Math., 15(3):835–855, 1965.
  • [3] Ryan B. Hayward. Weakly triangulated graphs. J. Comb. Theory, Ser. B, 39(3):200–208, 1985.
  • [4] Ryan B. Hayward. Generating weakly triangulated graphs. Journal of Graph Theory, 21(1):67–69, 1996.
  • [5] Ryan B. Hayward, Chính T. Hoàng, and Frédéric Maffray. Optimizing weakly triangulated graphs. Graphs and Combinatorics, 5(1):339–349, 1989.
  • [6] Lilian Markenzon, Oswaldo Vernet, and Luiz Henrique Araujo. Two methods for the generation of chordal graphs. Annals OR, 157(1):47–60, 2008.
  • [7] Brendan D. McKay and Nicholas C. Wormald. Uniform generation of random regular graphs of moderate degree. J. Algorithms, 11(1):52–67, 1990.
  • [8] Asish Mukhopadhyay, S. V. Rao, Sidharth Pardeshi, and Srinivas Gundlapalli. Linear layouts of weakly triangulated graphs. Discrete Math., Alg. and Appl., 8(3):1–21, 2016.
  • [9] H. Prüfer. Neuer beweis eines satzes über permutationen. Arch. Math. Phys., 27:742–744, 1918.
  • [10] Jeremy P. Spinrad and R. Sritharan. Algorithms for weakly triangulated graphs. Discrete Applied Mathematics, 59(2):181–191, 1995.
  • [11] G. Tinhofer. Generating Graphs Uniformly at Random, pages 235–255. Springer Vienna, Vienna, 1990.
  • [12] Nicholas C. Wormald. Generating random regular graphs. J. Algorithms, 5(2):247–280, 1984.
  • [13] Nicholas C. Wormald. Generating random unlabelled graphs. SIAM J. Comput., 16(4):717–727, 1987.