Sponsored Content
Full Discussion: Graph in java
Top Forums Programming Graph in java Post 302711235 by DGPickett on Friday 5th of October 2012 02:38:40 PM
Old 10-05-2012
A class for nodes ( coordinates, a (stock) collection of line references ) and a class for lines ( 2 end node references and maybe cached length ), where lines by definition run between not through nodes, even if another line goes out the other side in line with the first, and the class for the graph is a (stock) collection of nodes. Normal graphs have nodes ordered by coordinate x, y, z order. Normal lines will have the first node lower in order. Normal nodes have the lines in remote end order. Normalization can halve the computational load of many searches, and suggests an ordered collection like an array or tree, not a hash. However, if the majority of searches are equal, and there are many elements, hash mapping may be faster and collections should be considered orderless. If the set in your graphs is very dynamic and collections large, a linear hash or tree is good - no sliding arrays up and down. (Do intersecting lines make a node, or do they magically miss if no node is established, like ship lanes in the ocean?)

I suppose the lines could be in the node only, but they would be there twice -- if far node coord > this node coord then continue?

Might want a trivial class for coord that knows how to compare them.

Last edited by DGPickett; 10-05-2012 at 04:42 PM..
 

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Graph generation

How can I generate graphs using perl in unix solaris environment? Please suggest. (2 Replies)
Discussion started by: wadhwa.pooja
2 Replies

2. AIX

Performance graph

Guru's I need to develop a graph which shows the CPU, memory and swap space utilization in a single graph against time I know of NMON but I am not able to make a single graph out of it. Does anyone know of any script or tool for data sampling and developing graph? Thanks in advance ... (1 Reply)
Discussion started by: balaji_prk
1 Replies

3. Shell Programming and Scripting

FS Growth Graph

It's been a while since i've been here.. and hopefully you can help me. I have created a script to get the filesystem utilization. Now i want to create a growth graph, which would show how much kb we increase per day. Here's the data 03-02-2010 00:00:00: /dev/md/dsk/d30 46473377 7355320... (5 Replies)
Discussion started by: ryandegreat25
5 Replies
Graph::AdjacencyMatrix(3pm)				User Contributed Perl Documentation			       Graph::AdjacencyMatrix(3pm)

NAME
Graph::AdjacencyMatrix - create and query the adjacency matrix of graph G SYNOPSIS
use Graph::AdjacencyMatrix; use Graph::Directed; # or Undirected my $g = Graph::Directed->new; $g->add_...(); # build $g my $am = Graph::AdjacencyMatrix->new($g); $am->is_adjacent($u, $v) my $am = Graph::AdjacencyMatrix->new($g, distance_matrix => 1); $am->distance($u, $v) my $am = Graph::AdjacencyMatrix->new($g, attribute_name => 'length'); $am->distance($u, $v) my $am = Graph::AdjacencyMatrix->new($g, ...); my @V = $am->vertices(); DESCRIPTION
You can use "Graph::AdjacencyMatrix" to compute the adjacency matrix and optionally also the distance matrix of a graph, and after that query the adjacencyness between vertices by using the "is_adjacent()" method, or query the distance between vertices by using the "distance()" method. By default the edge attribute used for distance is "w", but you can change that in new(), see below. If you modify the graph after creating the adjacency matrix of it, the adjacency matrix and the distance matrix may become invalid. Methods Class Methods new($g) Construct the adjacency matrix of the graph $g. new($g, options) Construct the adjacency matrix of the graph $g with options as a hash. The known options are distance_matrix => boolean By default only the adjacency matrix is computed. To compute also the distance matrix, use the attribute "distance_matrix" with a true value to the new() constructor. attribute_name => attribute_name By default the edge attribute used for distance is "w". You can change that by giving another attribute name with the "attribute_name" attribute to new() constructor. Using this attribute also implicitly causes the distance matrix to be computed. Object Methods is_adjacent($u, $v) Return true if the vertex $v is adjacent to vertex $u, or false if not. distance($u, $v) Return the distance between the vertices $u and $v, or "undef" if the vertices are not adjacent. adjacency_matrix Return the adjacency matrix itself (a list of bitvector scalars). vertices Return the list of vertices (useful for indexing the adjacency matrix). ALGORITHM
The algorithm used to create the matrix is two nested loops, which is O(V**2) in time, and the returned matrices are O(V**2) in space. SEE ALSO
Graph::TransitiveClosure, Graph::BitMatrix AUTHOR AND COPYRIGHT
Jarkko Hietaniemi jhi@iki.fi LICENSE
This module is licensed under the same terms as Perl itself. perl v5.10.0 2005-04-16 Graph::AdjacencyMatrix(3pm)
All times are GMT -4. The time now is 03:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy