{"id":19664998,"url":"https://github.com/jonghough/javagraph","last_synced_at":"2025-02-27T03:43:38.854Z","repository":{"id":150486349,"uuid":"53732539","full_name":"jonghough/JavaGraph","owner":"jonghough","description":"A collection of graph algorithms","archived":false,"fork":false,"pushed_at":"2016-08-21T11:49:00.000Z","size":2229,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-10T02:25:54.978Z","etag":null,"topics":["algorithm","astar-algorithm","dijkstra","geometry","graph","graph-algorithms","graph-theory","graph-types","graphs","java","undirected-graphs","voronoi-diagram"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonghough.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-12T13:15:39.000Z","updated_at":"2016-03-12T13:18:54.000Z","dependencies_parsed_at":"2023-07-28T20:45:58.366Z","dependency_job_id":null,"html_url":"https://github.com/jonghough/JavaGraph","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonghough%2FJavaGraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonghough%2FJavaGraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonghough%2FJavaGraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonghough%2FJavaGraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonghough","download_url":"https://codeload.github.com/jonghough/JavaGraph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240974498,"owners_count":19887306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","astar-algorithm","dijkstra","geometry","graph","graph-algorithms","graph-theory","graph-types","graphs","java","undirected-graphs","voronoi-diagram"],"created_at":"2024-11-11T16:20:00.534Z","updated_at":"2025-02-27T03:43:38.829Z","avatar_url":"https://github.com/jonghough.png","language":"Java","readme":"[![Build Status](https://travis-ci.org/jonghough/JavaGraph.svg?branch=master)](https://travis-ci.org/jonghough/JavaGraph) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)]()\n# Java Graph Library\n\n## A collection of algorithms and datatypes for working with Graphs\n\n### Build\n`mvn clean install`\n### Run tests\n`mvn test`\n\n## Overview\n### Searching, Spanning, Cutting\n\n* Dijkstra's algorithm for undirected graphs\n* A*-algorithm for undirected graphs\n* Bellman-Ford algorithm for directed graphs\n* Ford-Fulkerson algorithm, for flow networks\n* Minimum spanning tree algorithm\n* Cycle finding algorithm\n* MinCut algorithm to find minimum cut\n\n### Geometry\n#### Voronoi Diagrams\nThe library contains classes to construct Voronoi Diagrams from arbitray collections of 2D points. To create Voronoi diagrams\nan implementation of *Fortune's algorithm* is used, with time complexity *~O(n log n)*.\n\n#### Examples\nIt is easy to create a voronoi diagram, for example, using `JavaFX`:\n```\npublic class VoronoiViewer extends Application {\n\n    static ArrayList\u003cNode2d\u003e nodeList;\n    public static VoronoiGenerator voronoi;\n\n    public static void main(String[] args) {\n\n\n        Random r = new Random();\n\n\n        nodeList = new ArrayList\u003cNode2d\u003e();\n\n        for(int j = 0; j \u003c 34; j++){\n            for(int k = 0; k \u003c 14; k++){\n                nodeList.add(new Node2d(3 + j*25 + 0.000*r.nextInt(663), 4 + k * 30+ j*j*0.25 + 0*r.nextInt(470)));\n            }\n        }\n        \n        voronoi = new VoronoiGenerator(nodeList);\n        voronoi.createDiagram();\n        \n        launch(args);\n   }\n  \n   @Override\n   public void start(Stage primaryStage) throws Exception {\n        primaryStage.setTitle(\"Voronoi Test\");\n\n\n        Group root = new Group();\n        Canvas canvas = new Canvas(800, 750);\n        GraphicsContext gc = canvas.getGraphicsContext2D();\n\n\n        gc.setStroke(Color.MAROON);\n\n        int total = 0;\n        double r = 0.5;\n        double g = 0.0;\n        double b = 1.0;\n        for(int i = 0; i \u003c voronoi.getNodes().size(); i ++){\n            Node2d ce = voronoi.getNodes().get(i);\n            HalfEdge edge= ce.halfEdge;\n\n            HalfEdge f = edge;\n\n            gc.setStroke(Color.color(r,g,b));\n            gc.beginPath();\n            while(edge != null){\n                total++;\n                gc.setStroke(Color.color(r,g,b));\n                gc.beginPath();\n                gc.moveTo(edge.twin().getTarget().getX(), edge.twin().getTarget().getY());\n                gc.lineTo(edge.getTarget().getX(), edge.getTarget().getY());\n\n                gc.stroke();\n                edge = edge.next();\n                if(edge == null || f == edge)\n                    break;\n            }\n\n        }\n\n        gc.setFill(Color.FIREBRICK);\n        for (CircleEvent ce : voronoi.getAllCircleEvents()) {\n            gc.setFill(Color.DEEPPINK);\n            gc.fillOval(ce.getX()-2, ce.getY()-2, 4, 4);\n            gc.setStroke(Color.BLACK);\n\n        }\n        gc.setFill(Color.RED);\n\n        for (Node2d n : nodeList) {\n            gc.fillOval(n.getX() - 5f / 2, n.getY() - 5f / 2, 5, 5);\n\n        }\n\n        root.getChildren().add(canvas);\n\n        Scene scene = new Scene(root);\n        scene.setFill(Color.OLDLACE);\n\n        primaryStage.setScene(scene);\n        primaryStage.show();\n    } \n }\n```\n\n ![Pretty Voronoi](/images/prettypattern1.png)\n ![Pretty Voronoi](/images/prettypattern2.png)\n ![Pretty Voronoi](/images/random_with_triangulation.png)\n ![Pretty Voronoi](/images/random1.png)\n\n### Graph structure\n\n* Construction of various graph types of given size.\n* Chromatic number estimations\n* Graph colorizable algorithm\n* Chromatic polynomials for certain graph types\n* Construct Line graph **L(G)** of graph\n\n### Others\n* Genetic algorithm solution to TSP problem for a given **complete** graph.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonghough%2Fjavagraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonghough%2Fjavagraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonghough%2Fjavagraph/lists"}