Using doubly-nested subgraphs without connected nodes does not render #69

Closed
Sushisource opened this Issue Mar 22, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@Sushisource

I have created a repro case for this. I would expect this to generate output roughly like:

digraph structs {
    subgraph cluster_branch {
        subgraph UnChained {
            inode
        }
    }
}

Instead the output is just an empty digraph. This test fails.

    test("Dot rendering with one node") {
      import scalax.collection.Graph
      import scalax.collection.io.dot._
      import scalax.collection.io.dot.implicits._
      import scalax.collection.GraphEdge.DiEdge
      val g = Graph[Int, DiEdge](1)
      val root = DotRootGraph(
        directed = true,
        id = Some("structs")
      )
      val branchDOT = DotSubGraph(root,
                                  "cluster_branch",
                                  attrList = List(DotAttr("label", "branch")))
      val cSubGraph = DotSubGraph(branchDOT, "cluster_chained", attrList =
        List(DotAttr("label", "Chained")))
      val iSubGraph = DotSubGraph(branchDOT, "cluster_unchained", attrList =
        List(DotAttr("label", "UnChained")))
      val dot = g.toDot(
        dotRoot = root,
        edgeTransformer = _.edge match {
          case _ =>
            Some((root, DotEdgeStmt("hi", "guys")))
        },
        cNodeTransformer = Some({ _ => Some((cSubGraph, DotNodeStmt("cnode"))) }),
        iNodeTransformer = Some({ _ => Some((iSubGraph, DotNodeStmt("inode"))) })
      )
      assert(dot.contains("inode"))
    }

@peter-empen peter-empen added the bug label Apr 19, 2017

@peter-empen

This comment has been minimized.

Show comment
Hide comment
@peter-empen

peter-empen Apr 19, 2017

Contributor

Also, thanks for the nice example.

Contributor

peter-empen commented Apr 19, 2017

Also, thanks for the nice example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment