2013-04-11 6 views
0

다음 그래프가 왜 점으로 생성되지 않는지 알아낼 수 있습니까? 나는 문제가 headport와 tailport와 관련이 있다고 생각한다. 내가 그걸 꺼내면 작동하지만, 이상적으로 나는 그것들을 문체적인 이유로 남겨두기를 원합니다.graphviz가 완료되지 않는 문제

digraph G { 
    nodesep = 0.5; 
    0 [width=0.75, height=0.75, fontsize=20]; 
    1 [width=0.75, height=0.75, fontsize=20, shape=square]; 
    2 [width=0.75, height=0.75, fontsize=20]; 
    3 [width=0.75, height=0.75, fontsize=20]; 
    4 [width=0.75, height=0.75, fontsize=20]; 
    5 [width=0.75, height=0.75, fontsize=20, shape=square]; 
    6 [width=0.75, height=0.75, fontsize=20]; 
    7 [width=0.75, height=0.75, fontsize=20, shape=square]; 
    8 [width=0.75, height=0.75, fontsize=20, shape=square]; 
    9 [width=0.75, height=0.75, fontsize=20, shape=square]; 
    10 [width=0.75, height=0.75, fontsize=20, shape=square]; 
    11 [width=0.75, height=0.75, fontsize=20, shape=square]; 
    12 [width=0.75, height=0.75, fontsize=20]; 
    subgraph directed{ 
      rankdir= LR;rank= max; 
      0->1->2->3->4->5->6->7->8->9->10->11->12; 
    } 
    subgraph undirected{ 
      rankdir= LR;rank= min;edge[tailport=n,headport=n]; 
      0->1[dir=none, color=red]; 
      0->2[dir=none, color=red]; 
      1->9[dir=none, color=red]; 
      2->3[dir=none, color=red]; 
      2->8[dir=none, color=red]; 
      3->4[dir=none, color=red]; 
      4->8[dir=none, color=red]; 
      7->9[dir=none, color=red]; 
      8->9[dir=none, color=red]; 
      9->10[dir=none, color=red]; 
      9->11[dir=none, color=red]; 
      10->11[dir=none, color=red]; 
    } 
} 

답변

0

당신이 뭘 알고 있는지 알기 힘듭니다. 그러나 그래프에는 몇 가지 문제가 있습니다.

  • 노드는 여러 하위 그래프의 일부가 될 수 없습니다. 노드는 그래프 또는 하위 그래프의 어느 부분 에나 먼저 표시됩니다. 너 어디서 나타나야하니?
  • rankdir그래프 속성과

편집

가 귀하의 코멘트에 위로 다음은 서브 그래프에 적용 할 수 없습니다, 여기에 어떤 서브 그래프가없는 버전입니다. 그러나, 당신은 가장자리의 라우팅, 제어하기 어려울 무언가를 좋아하지 않을 것입니다.

아이디어는 노드를 일렬로 정렬 한 다음 노드의 순위에 영향을주지 않기 위해 constraint=false과 함께 다른 가장자리를 추가하는 것입니다. 소스를 통해 파고 많은 시간을 소비하지 않고

digraph G { 
    nodesep = 0.5; 
    node[width=0.75, height=0.75, fontsize=20]; 
    rankdir=LR; 

    0; 
    1 [shape=square]; 
    2; 
    3; 
    4; 
    5 [shape=square]; 
    6; 
    7 [shape=square]; 
    8 [shape=square]; 
    9 [shape=square]; 
    10 [shape=square]; 
    11 [shape=square]; 
    12; 

    0->1->2->3->4->5->6->7->8->9->10->11->12; 

    edge[constraint=false, tailport=n,headport=n,dir=none, color=red]; 
    0->1; 
    0->2; 
    1->9; 
    2->3; 
    2->8; 
    3->4; 
    4->8; 
    7->9; 
    8->9; 
    9->10; 
    9->11; 
    10->11; 
} 
+0

본질적으로 나는 directed 및 undirected 그래프로 연결되어야하는 노드가 있습니다. 노드 (번호가 0-12)는 다음과 같이 직선으로 나타나야합니다. 0-> 1-> 2-> 3-> 4-> 5-> 6-> 7 → 8 → 9 → 10 → 11 → 12; 방향이없는 가장자리가 북쪽 헤드 포트에 연결하고 노드 사이에 꼬리를 넣기를 원합니다. – Karrde

+0

@Karrde 나는 내 대답을 업데이트했다. 당신은 귀하의 의견에 귀하의 질문에 정보를 추가해야합니다, 그것은 당신이 무슨 일을하는지 이해하는 것이 유용합니다. – marapet

0

, 그 이유를 말할 어려울 것입니다,하지만 당신은 문제를 해결하기 위해 두 번째 서브 그래프에서 귀찮은 요소를 이동할 수 있습니다

1 제거를 -> 9 및 2-> 8을 추가하고 그 아래에 추가하십시오.

digraph G { 
    nodesep = 0.5; 
    0 [width=0.75, height=0.75, fontsize=20]; 
    1 [width=0.75, height=0.75, fontsize=20, shape=square]; 
    2 [width=0.75, height=0.75, fontsize=20]; 
    3 [width=0.75, height=0.75, fontsize=20]; 
    4 [width=0.75, height=0.75, fontsize=20]; 
    5 [width=0.75, height=0.75, fontsize=20, shape=square]; 
    6 [width=0.75, height=0.75, fontsize=20]; 
    7 [width=0.75, height=0.75, fontsize=20, shape=square]; 
    8 [width=0.75, height=0.75, fontsize=20, shape=square]; 
    9 [width=0.75, height=0.75, fontsize=20, shape=square]; 
    10 [width=0.75, height=0.75, fontsize=20, shape=square]; 
    11 [width=0.75, height=0.75, fontsize=20, shape=square]; 
    12 [width=0.75, height=0.75, fontsize=20]; 
    subgraph directed{ 
      rankdir= LR;rank= max; 
      0->1->2->3->4->5->6->7->8->9->10->11->12; 
    } 
    subgraph undirected{ 
      rankdir= LR;rank= min;edge[tailport=n,headport=n]; 
      0->1[dir=none, color=red]; 
      0->2[dir=none, color=red]; 
      2->3[dir=none, color=red]; 
      3->4[dir=none, color=red]; 
      4->8[dir=none, color=red]; 
      7->9[dir=none, color=red]; 
      8->9[dir=none, color=red]; 
      9->10[dir=none, color=red]; 
      9->11[dir=none, color=red]; 
      10->11[dir=none, color=red]; 
    } 
    1->9[dir="none", color="red", headport="n"]; 
    2->8[dir="none", color="red", headport="n"]; 
}