php中的定向依赖图

时间:2015-06-10 17:57:47

标签: graph

是否有可能在PHP的Yii框架或经典的PHP中构建有向依赖图。我想动态绘制这样的图形,

enter image description here

我有一组id:

Array ( [0] =>Array ( [0] => 10 [1] => 12 [2] => 14 [3] => 19 )
        [1] => Array ( [0] => 10 [1] => 13 [2] => 18 [3] => 20 )
        [2] => Array ( [0] => 10 [1] => 16 [2] => 14 [3] => 21 ) 
        [3] => Array ( [0] => 10 [1] => 12 [2] => 18 [3] => 19 )
        [4] => Array ( [0] => 10 [1] => 13 [2] => 14 [3] => 20 ) 
        [5] => Array ( [0] => 10 [1] => 16 [2] => 18 [3] => 21 ) 
        [6] => Array ( [0] => 10 [1] => 12 [2] => 14 [3] => 19 ) 
        [7] => Array ( [0] => 10 [1] => 13 [2] => 18 [3] => 20 ) 
        [8] => Array ( [0] => 10 [1] => 16 [2] => 14 [3] => 21 ) 
        [9] => Array ( [0] => 10 [1] => 12 [2] => 18 [3] => 19 ) 
        [10] => Array ( [0] => 10 [1] => 13 [2] => 14 [3] => 20 ) 
        [11] => Array ( [0] => 10 [1] => 16 [2] => 18 [3] => 21 ) 
        [12] => Array ( [0] => 10 [1] => 12 [2] => 14 [3] => 19 ) 
        [13] => Array ( [0] => 10 [1] => 13 [2] => 18 [3] => 20 ) 
        [14] => Array ( [0] => 10 [1] => 16 [2] => 14 [3] => 21 ) 
        [15] => Array ( [0] => 10 [1] => 12 [2] => 18 [3] => 19 ) 
        [16] => Array ( [0] => 10 [1] => 13 [2] => 14 [3] => 20 ) 
        [17] => Array ( [0] => 10 [1] => 16 [2] => 18 [3] => 21 ) 
    ) ;

1 个答案:

答案 0 :(得分:0)

我不了解PHP,但是从Maven依赖图中抽出一片叶子,你应该寻找一段生成依赖树的代码。因为依赖关系不能形成闭环;他们必须是树形的。