{"id":18305753,"url":"https://github.com/yaricom/gographml","last_synced_at":"2025-10-18T02:05:37.923Z","repository":{"id":94042564,"uuid":"163426661","full_name":"yaricom/goGraphML","owner":"yaricom","description":"The GraphML support for GO language ","archived":false,"fork":false,"pushed_at":"2024-05-15T11:58:53.000Z","size":92,"stargazers_count":14,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T06:51:20.818Z","etag":null,"topics":["golang","graphml","graphs"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/yaricom.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":"2018-12-28T15:55:14.000Z","updated_at":"2025-03-16T15:58:28.000Z","dependencies_parsed_at":"2024-06-19T11:19:07.498Z","dependency_job_id":"5438ba21-05f4-4381-9adc-915faca672cc","html_url":"https://github.com/yaricom/goGraphML","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaricom%2FgoGraphML","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaricom%2FgoGraphML/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaricom%2FgoGraphML/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaricom%2FgoGraphML/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yaricom","download_url":"https://codeload.github.com/yaricom/goGraphML/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247366909,"owners_count":20927618,"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":["golang","graphml","graphs"],"created_at":"2024-11-05T15:35:35.412Z","updated_at":"2025-10-18T02:05:37.909Z","avatar_url":"https://github.com/yaricom.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# goGraphML 🇺🇦 [![Made in Ukraine](https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7)](https://u24.gov.ua)\n\n[![CI](https://github.com/yaricom/goGraphML/actions/workflows/ci.yml/badge.svg)](https://github.com/yaricom/goGraphML/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/yaricom/goGraphML/graph/badge.svg?token=8J56DK078X)](https://codecov.io/gh/yaricom/goGraphML) [![GoDoc](https://godoc.org/github.com/yaricom/goGraphML/neat?status.svg)](https://godoc.org/github.com/yaricom/goGraphML/graphml) [![version](https://img.shields.io/github/v/tag/yaricom/goGraphML.svg?sort=semver)](https://github.com/yaricom/goGraphML/releases/latest)\n\nThe GraphML support for GO language\n\n## Overview\n\nThis repository includes implementation of [GraphML][1] specification to represent directed/undirected graphs with data-functions\nattached to any element of the resulting graph. Concept of data-functions provides great flexibility in managing additional\ndata which can be associated with Nodes, Edges, Graphs, etc.\n\n## Installation and Dependencies\n\nThe source code has no external dependencies except standard XML processing of GO platform. To install package into local\nenvironment run following command in terminal:\n\n```bash\n\ngo get -t github.com/yaricom/goGraphML\n\n```\n\n## Usage\n\nCurrent realisation provides implementation of basic subset of GraphML specification which allows to build Graphs which\nconsist of Nodes and Edges with additional attributes (data-functions) associated. The root element can maintain collection\nof graph elements, which allows to hold multiple Graphs in one object.\n\n### Declaring Root GraphML\n\nThe root GraphML is the container which maintains collection of Graph elements as well as a collection of custom data-functions\ndefinitions. The new GraphML element can be created as following:\n\n```GO\n\n    gml := NewGraphML(\"neural network solvers\")\n\n```\nwhere:\n\n* \"neural network solvers\" - is the human readable description associated with root element (optional)\n\n\n### Register Custom Data-Function\n\nThe custom data-function representing particular data attribute can be registered with root element using designated\nmethod or can be registered automatically when adding Graph, Node, Edge with specific attributes. The data-function can\nbe associated default value, which will can used by all elements referring this function key without providing data value.\n\nWith designated method it can be registered as following:\n\n```GO\n\n    key, err := gml.RegisterKey(KeyForNode, \"weight\", \"the weight of link\", reflect.Float64, 1.0)\n\n```\nwhere:\n\n* KeyForNode specifies that data-function must be applied only for Nodes (see KeyForElement constants)\n* \"weight\" - is the name of data attribute\n* \"the weight of link\" - is the human readable description of this data-function (optional)\n* reflect.Float64 - is the Kind of data (type) for accepted function value (see GraphMLDataType constants)\n* 1.0 - the default value for data-function\n\nThe automatic data-function registration for any element with Add* method from provided attributes will not result in creation\nof new Key definition if it is already defined in the element scope or in ALL elements scope. The existing Key elements will\nbe evaluated in order (see GetKey()):\n\n* first it will be looked for Key with given name and targeting specific element (graphml|graph|node|edge)\n* if not found then it will be looked for Key with given name and targeting ALL elements\n\nIf above lookup failed the new Key will be registered for given name and targeting specific element.\n\n### Declaring a Graph\n\nThe new Graph can be added with associated attributes as following:\n\n```GO\n    attributes := map[string]interface{}{\n        \"default_weight\": 1.1,\n        \"acyclic\":        false,\n        \"max_depth\":      10,\n    }\n\n    graph, err := gml.AddGraph(\"the graph\", EdgeDirectionDirected, attributes)\n\n```\nwhere:\n\n* \"the graph\" - is the human readable description for the graph\n* EdgeDirectionDirected specified that graph edges by default is directed (see EdgeDirection constants)\n* attributes - the data attributes to be associated with this Graph element\n\n### Declaring a Node\n\nThe Node elements can be added to the Graph as following:\n\n```GO\n    attributes := map[string]interface{}{\n        \"X\":                  0.1,\n        \"Y\":                  1.0,\n        \"NodeNeuronType\":     network.InputNeuron,\n        \"NodeActivationType\": network.NullActivation,\n    }\n\n    node, err := gr.AddNode(attributes, \"the input node\")\n\n```\nwhere:\n\n* attributes - the data attributes to be associated with this Node element\n* \"the input node\" - is the human readable description (optional)\n\n### Declaring an Edge\n\nThe Edge elements can be added to the Graph as following:\n\n```GO\n    attributes := map[string]interface{}{\n        \"weight\":   -1.1,\n        \"sourceId\": 1,\n        \"targetId\": 3,\n    }\n\n    edge, err := gr.AddEdge(n1, n2, attributes, EdgeDirectionDefault, \"the first level\")\n\n```\nwhere:\n\n* n1 - the source Node element reference\n* n2 - the target Node element reference\n* EdgeDirectionDefault - the Edge direction specification which will override Graph direction if not EdgeDirectionDefault\n* \"the first level edge\" - is the human readable description (optional)\n\n\n### The GraphML Serialization\n\nThe collected GraphML data can be serialized into well defined XML format (see [GraphML specification][1]) using following\ncommand:\n\n```GO\n\n    err := gml.Encode(writer, false)\n\n```\nwhere:\n\n* `writer` - is an `io.Writer` to receive serialized data\n* `false` - is a flag to indicate whether XML should be generated with indents to improve readability (`true`) or without to\nhave more compact representation (`false`)\n\nThe GraphML can also be read from serialized representation using following command:\n\n```GO\n\n    err := gml.Decode(reader)\n\n```\nwhere:\n\n* `reader` - is an `io.Reader` to read data from\n\n## Limitations\n\nThe current version does not implement the following parts of GraphML specification:\n\n* Nested Graphs\n* Hyper-Edges\n* Ports\n\n## References:\n\n1. The original [GraphML specification][1]\n\n\n[1]:http://graphml.graphdrawing.org/specification.html","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaricom%2Fgographml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyaricom%2Fgographml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaricom%2Fgographml/lists"}