Comments (2)
@dominikbraun Thanks for your detailed answer, it is helpful to me. :D
from graph.
Hi! You need the attributes colorscheme
, color
, fillcolor
, and if you want, fontname
. Additionally, you need the style
attribute set to filled
.
You can add these attributes using the VertexAttribute
option. A graph like in the example could be created as follows (using the Brewer color scheme):
_ = g.AddVertex(1, graph.VertexAttribute("colorscheme", "blues3"), graph.VertexAttribute("style", "filled"), graph.VertexAttribute("color", "2"), graph.VertexAttribute("fillcolor", "1"));
_ = g.AddVertex(2, graph.VertexAttribute("colorscheme", "greens3"), graph.VertexAttribute("style", "filled"), graph.VertexAttribute("color", "2"), graph.VertexAttribute("fillcolor", "1"));
_ = g.AddVertex(3, graph.VertexAttribute("colorscheme", "purples3"), graph.VertexAttribute("style", "filled"), graph.VertexAttribute("color", "2"), graph.VertexAttribute("fillcolor", "1"));
_ = g.AddVertex(4, graph.VertexAttribute("colorscheme", "ylorbr3"), graph.VertexAttribute("style", "filled"), graph.VertexAttribute("color", "2"), graph.VertexAttribute("fillcolor", "1"));
_ = g.AddVertex(5, graph.VertexAttribute("colorscheme", "reds3"), graph.VertexAttribute("style", "filled"), graph.VertexAttribute("color", "2"), graph.VertexAttribute("fillcolor", "1"));
Rendering this will yield the following graph:
To arrange the nodes like in the example, you can use the osage engine for rendering the DOT file - I think this can be done by passing the -Kosage
flag to the dot
command. The DOT playground yields the following graph:
Now, all you need to do is to add the width
and height
vertex attributes, and set the fixedheight
attribute to true
.
from graph.
Related Issues (20)
- Return a slice of all vertices in the graph. HOT 1
- RemoveVertex from graph HOT 2
- go1.20.5 type problem HOT 4
- GitHub Actions CI could be optimized HOT 1
- Shortest Path Doesn't Support Negative Edge Weights Properly HOT 6
- Query edges from/to given vertex HOT 4
- Vertex Attributes And Edge Attributes auto add double quote
- BFSWithDepth not calculating depth correctly HOT 3
- DAG Graph Pagination
- No way to list vertices? HOT 1
- How to split graph into disconnected subgraphs HOT 4
- Expose MemoryStore HOT 1
- can i find the leader/source vertex of a directed acyclic graph ? HOT 5
- multigraph support HOT 4
- Topological sort has a significant performance penalty HOT 1
- Feature Request: Add method for updating Vertex property HOT 1
- Feature: Add method for querying toVertex/fromVertex and steps HOT 1
- can value of vertexAttribute be of type 'any' ?
- guidance on marshaling/unmarshaling
- VertexAttributes func caching last values
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graph.