2017-08-16 127 views
0

假設我創建了以下圖表。我的問題是如何可視化它?PYSPARK:如何可視化GraphFrame?

# Create a Vertex DataFrame with unique ID column "id" 
    v = sqlContext.createDataFrame([ 
     ("a", "Alice", 34), 
     ("b", "Bob", 36), 
     ("c", "Charlie", 30), 
    ], ["id", "name", "age"]) 
    # Create an Edge DataFrame with "src" and "dst" columns 
    e = sqlContext.createDataFrame([ 
     ("a", "b", "friend"), 
     ("b", "c", "follow"), 
     ("c", "b", "follow"), 
    ], ["src", "dst", "relationship"]) 
    # Create a GraphFrame 
    from graphframes import * 
    g = GraphFrame(v, e) 
+0

亞歷克斯:你問的可視化工具,技術等...可視化圖框?那麼你可以看到筆記本接口。請參閱[使用Apache Spark的GraphFrames實時飛行性能](https://databricks.com/blog/2016/03/16/on-time-flight-performance-with-graphframes-for-apache-spark.html) –

+0

@RamGhadiyaram我希望最好使用spark/python庫可視化圖形。如果沒有使用工具的東西 – Alex

回答

0

我找不到任何可視化數據的原生GraphFrame庫。儘管如此,您可以嘗試使用display()函數從DataBricks中執行此操作。你可以看到一個例子here

此外,您可以嘗試將GraphFrame轉換爲python列表,並使用matplotlibPygraphviz庫。