Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
I have a graph with weighted edges in Neo4j. I visualized it with neovis.js library as shown in the attached figure. Currently, all edges have same color. In the next step I need to assign colors to edges such that every group (Cluster or Community) of edges has a different color based on a predefined property of the edges (the property is defined for edges not vertices).
My graph node and relationship are stored as follows:
Node: Vertex (index, name), Ex: (42, "Vertex 23")
Relationship: EDGE (index, count, group), Ex: (12, 42, 0), (24, 230, 1)
(:Vertex)-[:EDGE]->(:Vertex)
Here is my code for creating the graph:
<script src="https://rawgit.com/neo4j-contrib/neovis.js/master/dist/neovis.js"></script>
<script>
function draw() {
var config = {
container_id: "viz",
server_url: "bolt://localhost:7687",
server_user: "***",
server_password: "***",
labels: {
"Vertex": {
caption: "name"
relationships: {
"EDGE": {
caption: false,
thickness: "count"
initial_cypher: "MATCH p=()-[:RELATIONSHIP]->() RETURN p"
var viz = new NeoVis.default(config);
viz.render();
</script>
<body onload="draw()">
<div id="viz"></div>
</body>
</html>
It would be good if I can map a specific color to each group as well.
Let's say group is a binary property, so I want something like this:
relationships: {
"EDGE": {
caption: false,
thickness: "count"
color: "group" {0: red, 1: green}
–
Thanks for contributing an answer to Stack Overflow!
-
Please be sure to
answer the question
. Provide details and share your research!
But
avoid
…
-
Asking for help, clarification, or responding to other answers.
-
Making statements based on opinion; back them up with references or personal experience.
To learn more, see our
tips on writing great answers
.