-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ZEPPELIN-2222] Add Network Visualization #2125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+47.7 KB
docs/assets/themes/zeppelin/img/screenshots/display_complex_network.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41 KB
docs/assets/themes/zeppelin/img/screenshots/display_network_flatten.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+31.2 KB
docs/assets/themes/zeppelin/img/screenshots/display_simple_network.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,3 +61,104 @@ If table contents start with `%html`, it is interpreted as an HTML. | |
| <img src="../assets/themes/zeppelin/img/screenshots/display_table_html.png" /> | ||
|
|
||
| > **Note :** Display system is backend independent. | ||
|
|
||
| ## Network | ||
|
|
||
| With the `%network` directive, Zeppelin treats your output as a graph. Zeppelin can leverage the Property Graph Model. | ||
|
|
||
| ### What is the Labelled Property Graph Model? | ||
|
|
||
| A [Property Graph](https://github.com/tinkerpop/gremlin/wiki/Defining-a-Property-Graph) is a graph that has these elements: | ||
|
|
||
| * a set of vertices | ||
| * each vertex has a unique identifier. | ||
| * each vertex has a set of outgoing edges. | ||
| * each vertex has a set of incoming edges. | ||
| * each vertex has a collection of properties defined by a map from key to value | ||
| * a set of edges | ||
| * each edge has a unique identifier. | ||
| * each edge has an outgoing tail vertex. | ||
| * each edge has an incoming head vertex. | ||
| * each edge has a label that denotes the type of relationship between its two vertices. | ||
| * each edge has a collection of properties defined by a map from key to value. | ||
|
|
||
| <img src="https://github.com/tinkerpop/gremlin/raw/master/doc/images/graph-example-1.jpg" /> | ||
|
|
||
| A [Labelled Property Graph](https://neo4j.com/developer/graph-database/#property-graph) is a Property Graph where the nodes can be tagged with **labels** representing their different roles in the graph model | ||
|
|
||
| <img src="http://s3.amazonaws.com/dev.assets.neo4j.com/wp-content/uploads/property_graph_model.png" /> | ||
|
|
||
| ### What are the APIs? | ||
|
|
||
| The new NETWORK visualization is based on json with the following params: | ||
|
|
||
| * "nodes" (mandatory): list of nodes of the graph every node can have the following params: | ||
| * "id" (mandatory): the id of the node (must be unique); | ||
| * "label": the main Label of the node; | ||
| * "labels": the list of the labels of the node; | ||
| * "data": the data attached to the node; | ||
| * "edges": list of the edges of the graph; | ||
| * "id" (mandatory): the id of the edge (must be unique); | ||
| * "source" (mandatory): the id of source node of the edge; | ||
| * "target" (mandatory): the id of target node of the edge; | ||
| * "label": the main type of the edge; | ||
| * "data": the data attached to the edge; | ||
| * "labels": a map (K, V) where K is the node label and V is the color of the node; | ||
| * "directed": (true/false, default false) wich tells if is directed graph or not; | ||
| * "types": a *distinct* list of the edge types of the graph | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you include a sample of the json?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
|
|
||
| If you click on a node or edge on the bottom of the paragraph you find a list of entity properties | ||
|
|
||
| <img src="../assets/themes/zeppelin/img/screenshots/display_network.png" /> | ||
|
|
||
| This kind of graph can be easily *flatten* in order to support other visualization formats provided by Zeppelin. | ||
|
|
||
| <img src="../assets/themes/zeppelin/img/screenshots/display_network_flatten.png" /> | ||
|
|
||
| ### How to use it? | ||
|
|
||
| An example of a simple graph | ||
|
|
||
| ``` | ||
| %spark | ||
| print(s""" | ||
| %network { | ||
| "nodes": [ | ||
| {"id": 1}, | ||
| {"id": 2}, | ||
| {"id": 3} | ||
| ], | ||
| "edges": [ | ||
| {"source": 1, "target": 2, "id" : 1}, | ||
| {"source": 2, "target": 3, "id" : 2}, | ||
| {"source": 1, "target": 2, "id" : 3}, | ||
| {"source": 1, "target": 2, "id" : 4}, | ||
| {"source": 2, "target": 1, "id" : 5}, | ||
| {"source": 2, "target": 1, "id" : 6} | ||
| ] | ||
| } | ||
| """) | ||
| ``` | ||
|
|
||
| that will look like: | ||
|
|
||
| <img src="../assets/themes/zeppelin/img/screenshots/display_simple_network.png" /> | ||
|
|
||
| A little more complex graph: | ||
|
|
||
| ``` | ||
| %spark | ||
| print(s""" | ||
| %network { | ||
| "nodes": [{"id": 1, "label": "User", "data": {"fullName":"Andrea Santurbano"}},{"id": 2, "label": "User", "data": {"fullName":"Lee Moon Soo"}},{"id": 3, "label": "Project", "data": {"name":"Zeppelin"}}], | ||
| "edges": [{"source": 2, "target": 1, "id" : 1, "label": "HELPS"},{"source": 2, "target": 3, "id" : 2, "label": "CREATE"},{"source": 1, "target": 3, "id" : 3, "label": "CONTRIBUTE_TO", "data": {"oldPR": "https://github.com/apache/zeppelin/pull/1582"}}], | ||
| "labels": {"User": "#8BC34A", "Project": "#3071A9"}, | ||
| "directed": true, | ||
| "types": ["HELPS", "CREATE", "CONTRIBUTE_TO"] | ||
| } | ||
| """) | ||
| ``` | ||
|
|
||
| that will look like: | ||
|
|
||
| <img src="../assets/themes/zeppelin/img/screenshots/display_complex_network.png" /> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,8 @@ public static enum Type { | |
| TABLE, | ||
| IMG, | ||
| SVG, | ||
| NULL | ||
| NULL, | ||
| NETWORK | ||
| } | ||
|
|
||
| Code code; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -557,3 +557,7 @@ table.table-striped { | |
| .markdown-body h4 { | ||
| font-size: 16px; | ||
| } | ||
|
|
||
| .network-labels { | ||
| margin: 0.2em; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sidenote: would be great to support tinkerpop? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any special reason to use github hosted image instead of adding a new one to Zeppelin source?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AhyoungRyu sorry i had lost your comment, no there is no special reason (it's taken from the Property Graph Model page), if you think is better I can import the image inside the project