Code Monkey home page Code Monkey logo

Comments (7)

anvaka avatar anvaka commented on July 28, 2024

Interesting idea... Currently centrality is used only by Amazon products visualization to sort products by betweenness centrality. I call it "Diversity" there, because I could not come up with a better name.

Here is how you can calculate centralities of a graph:

// Let's say you have graph = Viva.Graph.graph();
var calculator = Viva.Graph.centrality();
var betweenness = calculator.betweennessCentrality(graph);
// betweenness is an array of objects {key: , value: }, where key is a node id 
// in the graph and value is actual betweenness centrality value for this node.
// The array is sorted in descending order of betweenness centrality.

var degree = calculator.degreeCentrality(graph);
// degree will be an array of the same structure as betweenness, but
// value represents degree centrality of the node.

Can you please elaborate on how do you want to place nodes more centrally according to centrality?

from vivagraphjs.

unikitty37 avatar unikitty37 commented on July 28, 2024

Thanks — I'd worked out how to actually get the array from Viva.Graph.centrality(), but I can't see how to make the renderer do anything with that information. Basically, what we're trying to do is have a force-directed graph where nodes with a higher centrality gravitate towards the centre, and nodes with a lower centrality are pushed towards the outer regions — all subject to the effects of their connections, of course.

It looks like that's what you're doing with Amazon, but I can't quite work out how :)

from vivagraphjs.

sy-tang avatar sy-tang commented on July 28, 2024

@TinyClanger I'm dealing exactly the same problem, if you have come up with any solution, please let me know. It would be great helpful. By the way, I'm working on visualizing a person's social network online.

from vivagraphjs.

anvaka avatar anvaka commented on July 28, 2024

Amazon visualization does not use centrality information for rendering. It pins the root node to prevent the entire graph from flying away. Here is a demo: How to pin node in vivagraph. Force-based layout also uses number of edges to determine a weight of each node. So the more connection a node has the higher is its mass.

from vivagraphjs.

xdiscovery avatar xdiscovery commented on July 28, 2024

Hello! I've looked at example, I was not aware of possibility of pinning a node.
I created an example using force-directed layout; when I add and update neighbors to a node, the new ones appears in the center of the canvas rather than around the parent node. This cause the whole cluster to be pulled towards the center, and with highly densed networks, the center of the canvas because pretty soon over-crowded.
Which is the part that calculate the positions of the new nodes respect to a parent?
As effect I would like the neighbors to pop up around the parent.

from vivagraphjs.

arikan avatar arikan commented on July 28, 2024

Hey Andrei,

I've been trying the centrality functions, calling it after adding links, but it returns empty arrays both for degree and betweenness centrality. What might be wrong here?

from vivagraphjs.

anvaka avatar anvaka commented on July 28, 2024

Hi @arikan do you have a code sample?

from vivagraphjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.