项目作者: explorablesforsfi

项目描述 :
Try finding the maximum weight independent set of a tree.
高级语言: JavaScript
项目地址: git://github.com/explorablesforsfi/max-weight-independent-set.git
创建时间: 2019-04-19T04:00:15Z
项目社区:https://github.com/explorablesforsfi/max-weight-independent-set

开源协议:Other

下载


Maximum Weight Independent Set

Try finding a set of nodes which are not connected and whose cumulative scores are maximal.

Run

First, clone this repository

  1. git clone https://github.com/explorablesforsfi/max-weight-independent-set.git

Then change to the created directory and start a local webserver

  1. cd max-weight-independent-set
  2. python -m "http.server" 1313

Go to your browser and navigate to http://localhost:1313 .

max-weight-independent-set

Modify

Add your own tree as a json-file and load it in index_html as graph_url = './path/to/tree.js'. This file must be of the following structure:

  1. {
  2. "children": [
  3. {
  4. "children": [
  5. {
  6. "id": 3,
  7. "weight": 4
  8. },
  9. {
  10. "id": 5,
  11. "weight": 6
  12. }
  13. ],
  14. "id": 1,
  15. "weight": 7
  16. },
  17. {
  18. "children": [
  19. {
  20. "children": [
  21. {
  22. "id": 6,
  23. "weight": 1
  24. },
  25. {
  26. "id": 7,
  27. "weight": 2
  28. }
  29. ],
  30. "id": 4,
  31. "weight": 5
  32. }
  33. ],
  34. "id": 2,
  35. "weight": 8
  36. }
  37. ],
  38. "id": 0,
  39. "weight": 4
  40. }

License

All original code in this repository, i.e. all code which is not in the subdirectory /libs/ is licensed under the CC 4.0 licence. The subdirectory /libs/ contains external libraries which are licensed as follows

File name License Link to repository
d3.v5.min.js BSD 3-Clause “New” or “Revised” License d3
widget.v3.4.js permission to use given by D. Brockmann complexity explorables