javascript - How do I collapse a user-topic network graph to a user-user graph? -


i have d3 force directed graph shows user-topic relationship. want collapse user-user graph.

enter image description here node data looks this:

[{     "id": "user",     "type": "u", }, {     "id": "user",     "type": "u", }, {     "id": "user",     "type": "u", }, {     "id": "topic",     "type": "t", }, {     "id": "topic",     "type": "t", }] 

and edges data looks this:

[{     "source": "topic",     "target": "user",     "score": 5 }, {     "source": "topic",     "target": "user",     "score": 48 }] 

how go collapsing graph?

i've had task before, more warning of potential pitfalls answer, might useful , won't fit in comment.

the main point need build new set of edges, there's non-trivial decisions / assumptions need made.

firstly sort divide current set of edges topic. set of users mentioned within each topic edge set should connected each other in user-user graph share topic. first problem should scores in original data set, mean now? strength of link between 2 users piece of edge data mention above? 48 + 5? (48 + 5) / 2? unknown?

once more 1 topic you'll multiple edges between same users occur if have more 1 topic in common. do here? keep individual edges, need method of differentiating them both in data set (they'll need different ids incorporate topic user ids) , visually, default layout edges overplot each other. or merge edges between users different topics, again how calculate score? simple +1 each added link? formula based on links individual scores?

the news don't need node set. users there, filter out topics.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -