Code this example in javascript for standalone demo
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

There is a simple interactive demonstration written in the wolfram language:

http://demonstrations.wolfram.com/RandomSubgraphOfACompleteGraph/

I'd like to see someone implement it with javascript, so it runs fast and responsively in a webpage.

Use whatever libraries you need! Prefereably make it a node project.

awarded to chesedo

Crowdsource coding tasks.

2 Solutions


Hello,

Here is a working demo generating a full graph using Cytoscape

You just have to set the node count you want and click on generate, the graph will be displayed below.
This demo also uses JQuery for getting elements. The full code can be seen in the HTML source code.

Is this what you wanted ?

I like the initial graph generation but there's no slider for random subgraph highlighting, and there shouldn't be any buttons, just two sliders.
mr142 almost 3 years ago
Winning solution

Good day,

My codePen solution which makes use of the D3 library. Feel free to point out anything that I missed.

Very nice! But it doesn't update until I release the slider, is there any way you can make it continuously update the instant I move the slider bar? It's important that it be responsive immediately.
mr142 almost 3 years ago
@mr142 I updated the pen (sorry missed the responsive requirement)
chesedo almost 3 years ago
Thanks so much. I have another for you if you're up to it :)
mr142 almost 3 years ago
@mr142 yw. I'll keep my eye out for any new bounties that you may post - will have to see if i'm up for it thought :D
chesedo almost 3 years ago
@chesedo I just posted the new one, I'll wait for your answer.
mr142 almost 3 years ago
@mr142 that is currently just over my head... i looked up what cellular automaton is and still can not figure what the graph is (the b/w one i understand thought)...
chesedo almost 3 years ago
@chesedo I added a few simpler alternatives to my other bounty, maybe you could attempt one of the alternates? :)
mr142 almost 3 years ago
@mr142 I'll see if i might be able to do one of them tomorrow.
chesedo almost 3 years ago
View Timeline