Directed graph problem

I need to represent a transport network in java and have found that a graph seems to be the best way to do this, I initially thought that an undirected graph would be best but after thinking about it I need a directed graph in order to represent weightings for routes in each direction.
Is there a type of graph or java class I should use for this purpose?

You could look at:
http://sourceforge.net/projects/jgrapht/
Pete

Similar Messages

  • A problem about the compression of directed graphs

    Right now I encountered a problem in my research that is about graph compressing (or contraction, etc.). I've searched in various ways for existing techniques on this problem and found nothing. I've been trying to figure out this problem by myself. However I would also like to seek some advice from you guys.
    The description of this problem:
    Given a directed graph G = (V, E) where V is the set of vertices and E
    is the set of directed edges. These vertices and directed edges
    represent the events and the directional relationships between pairs of
    events. Each edge is associated with a weight (or confidence score)
    which indicates the degree of the relationship. Now I want to compress
    the graph by merging some of the vertices into one superior vertex,
    which implies that several lower-level events are merged into one
    high-level event (this is mainly because the extent of news events
    defined are usually flexible). After that we can reorganize the
    vertices and edges and repeat this process until the size of the graph
    reaches a certain limit. Purely looking from the point of graph theory,
    is there any existing graph algorithm that solves this problem? As far as I have searched, the answer seems to be negative.This seems to be an interesting novel problem which falls in the area of graph algorithms. Could you suggest anything? Attached is a sample directed graph of such a kind which may be interesting.
    Check this URL to find out more about this kind of DAG:
    http://ihome.cuhk.edu.hk/~s042162/2005-05-24.jpg
    Thank you very much for your time and help.
    Regards,
    Daniel

    Sounds like an interesting problem. The temporal aspect presents an interesting wrinkle. Graph models have been becoming popular for the standard clustering problem recently, but they are typically undirected formulations. The idea of compressing a graph reminded me of work done by G. Karypis and V. Kumar on graph partitioning, some of their papers are available here:
    http://www-users.cs.umn.edu/~karypis/publications/partitioning.html
    SImilar to the reference given by matfud, with the additional restriction that there may be a size restriction on the size of the partitions or there may be multiple partitions (both restrictions make the problem NP-complete, IIRC).
    There's also the area of spectral graph partitioning which may be of interest. Its a way of finding relatively dense areas in a graph by using the eigenvalues of the adjacency matrix. Most of the results in this area are dependent on the fact that adjacency matrices for graphs are symmetric and semi-definite, which wouldn't be the case for a directed graph, but could be worth some experimentation if you have MATLAB or something similar.
    There's something else this problem reminds me of, but I can't think of it right now. Maybe later something will come to me.
    Good luck.

  • Directed graphs

    Help
    Having a problem with my directed graph, and its been frying my head. from the test that I've ran ita ppears to be working sort of the problem that I'm having is once I've created a node, I then attach an edge to that node, however where there are multiple edges it will only attach the last edge that it comes to. I'm creating a list of nodes, then trying to attach a list of edges to that particular node.
    code listing - theres a lot, sorry
    /////////////////////// edge class /////////////////////////
    //: Gedge.java
    /************************* Revision History *************************
    *     v1.0 - Initial version:
    public class Gedge implements IGedge{
         //labels for the edges
         private Object s, l;
         //nodes representing stations outbound and inbound
         private Gnode src, in, out;
         //linked list of edges
         private Gedge nextOutEdge;
         private Object o, i;
         * Default constructor Gedge
         * @param Gnode outbound:
         * @param Gnode inBound:
         * @param Object stationID:
         * @param Object lineName:
         public Gedge ( Gnode source, Gnode inDest, Gnode outDest, Object outBound, Object inBound, Object stationID, Object lineName ){
              o = outBound;
              i = inBound;
              s = stationID;
              l = lineName;
              src = source;
              in = inDest;
              out = outDest;
              //dest1 = null;
              nextOutEdge = null;
         }//end of constructor
         /////////////// Accessors ///////////////
         public Object getInBound() {
              return ( ( String ) i );
         }//end of getInBound
         public Object getOutBound() {
              return ( ( String ) o );
         }//end of getOutBound
         * @return
         public Object getLineName() {
              return ( ( String ) l );
         }//end of getLineBound
         public Object getStationID(){
              return ( ( String ) s );
         * @return
         public Gedge getNextEdge(){
              return nextOutEdge;
         }//end of getNextEdge
         * @return
         public Gnode getSource(){
              return src;
         }//end of getSource
         * @param newNextEdge
         public Gnode getInDest(){
              return in;
         * @param newNextEdge
         public Gnode getOutDest(){
              return out;
         * @param newNextEdge
         //public Gnode getDest1(){
         //     return dest1;
         /////////////// Transformers ///////////////
         public void setNextEdge( Gedge newNextEdge){
              nextOutEdge = newNextEdge;
         }//end of setNextEdge
         public void setInBound( Object inBound ) {
              i = inBound ;
         }//end of setDest
         public void setOutBound( Object outBound ) {
              o = outBound;
         }//end of setSource
         public void setLineName( Object lineName ) {
              l = lineName;
         }//end of setLineName
    }///:~
    ///////////////// end of edge class /////////////
    ///////////////node class////////////////
    //: Gnode.java
    /************************* Revision History *************************
    *     v1.0 - Initial version:
    public class Gnode implements IGnode {
         private Object id, name;
         private Comparable d;
         private Gnode nextNode;
         private Gedge firstEdge, nextOutEdge;
         private int outDegree;
         public Gnode ( Comparable data, Object stationName, Object stationID){
              d = data;
              id = stationID;
              name = stationName;
              outDegree = 0;
              nextNode = null;
              firstEdge = null;
              nextOutEdge = null;
         }//end of constructor
         /////////////// Accessors ///////////////
         public Object getID() {
              return ( ( String ) id );
         }//end of getID()
         public Object getStationName() {
              return ( ( String ) name );
         }//end of getStationName
         public Comparable getData() {
              return d;
         }//end of getData
         * @return
         public Gnode getNextNode(){
              return nextNode;
         }//end of getNextNode
         * @return
         public int getOutDegree(){
              return outDegree;
         }//end of incOutDegree
         * @return
         public Gedge getNextEdge(){
              return nextOutEdge;
         }//end of getFirstOutEdge
         * @return
         public Gedge getFirstEdge(){
              return firstEdge;
         /////////////// Transformers ///////////////
         public void setStationName( Object stationName ){
              name = stationName;
         }//end of setStationName
         * @param data
         public void setComparable( Comparable data ){
              d = data;
         }//end of setComparable
         public void setStationID(Object stationID) {
              id = stationID;
         }//end of setStationID
         * @param newNext
         public void setNextNode( Gnode newNode ){
              nextNode = newNode;
         }//end of setNextNode
         public void setNextEdge( Gedge edge ){
              nextOutEdge = edge;
         }//end of setFirstOutEdge
         public void setFirstEdge( Gedge edge ){
              firstEdge = edge;
         }//end of setFirstOutEdge
         public void incOutDegree(){
              outDegree++;
         }//end of incOutDegree
    }///:~
    //////////////end of node class /////////////
    ////////////// graph class ////////////////////
    //: AMGraph.java
    /************************* Revision History *************************
    *     v1.0 - Initial version:
    public class AMGraph implements IAMGraph {
         //2D-Array of graph nodes
         protected Gnode firstNode, node;
         //graph edges
         protected Gedge firstEdge, edge;
         private int gSize;
         /////////////// Constructor ///////////////
         public AMGraph(){
              firstNode = null;
              firstEdge = null;
              gSize = 0;
         /////////////// Accessors ///////////////
         public boolean isEmpty() {
              if ( firstNode == null){
                   return true;
              return false;
         }//end of isEmpty
         public boolean hasNeighbour() {
              // TODO Auto-generated method stub
              return false;
         }//end of hasNeighbour
         public int outDegree() {
              // TODO Auto-generated method stub
              return 0;
         }//end of outDegree
         public int inDegree() {
              // TODO Auto-generated method stub
              return 0;
         }//end of inDegree
         public void findPath(Object outBound, Object inBound) {
              // TODO Auto-generated method stub
         }//end of findPath
         public void printStationList(){
              Gnode temp = node;
              while( temp != null ){
                   System.out.println( temp.getID()+" "+temp.getStationName() );
                   temp = temp.getNextNode();
         }//end of printStationList
         public void printEdgeList( Gnode source ){
              Gedge temp;
              temp = source.getNextEdge();
              while( temp != null ){
                   System.out.println( temp.getStationID()+" out "+temp.getOutBound()+" in "+temp.getInBound() );
                   temp = source.getNextEdge();
         }//end of printEdgeList
         * @return
         public int getOutDegree ( ){
              int degree = 0;
              while( node != null ){
                   degree = node.getOutDegree();
                   node = node.getNextNode();
              return degree;
         }//end of getOutDegree
         * @param data
         * @return
         public Gnode getGNode ( String data ){
              Gnode temp = node;
              while( temp != null ){
                   if( temp.getID().equals(data) ){
                        return temp;
                   else{
                        temp = temp.getNextNode();
              return null;
         }//end of getGnode
         public boolean containsEdge( Gnode node0, Gnode node1) {
    Gnode source = node0, dest = node1;
    Gedge tempEdge = source.getNextEdge();
    while ( tempEdge != null){
         if ( tempEdge.getOutBound().equals( dest.getID() ) ){
              System.out.println("true");
              return true;
         else{
              tempEdge = tempEdge.getNextEdge();
    System.out.println("false");
    return false;
         }//end of containsEdge
         /////////////// Transformers ///////////////
         public void addNode( Comparable data, Object stationName, Object stationID ) {
              node = new Gnode( data, stationName, stationID );
              if ( firstNode == null ){
                   firstNode = node;
              else{
                   node.setNextNode( firstNode );
                   firstNode = node;
    gSize++;
         }//end of addNode
         public void addEdge( Gnode source, Gnode oBound, Gnode iBound, Object outBound, Object inBound, Object stationID, Object lineName ) {
    Gnode s = source;
    Gnode o = oBound;
    Gnode i = iBound;
    edge = new Gedge( s, o, i, outBound, inBound, stationID, lineName);
         s.setNextEdge( edge );
         edge.setNextEdge( s.getNextEdge() );
         }//end of addEdge
         public void removeNode(Comparable data) {
              // TODO Auto-generated method stub
         }//end of removeNode
         public void removeEdge(Comparable data) {
              // TODO Auto-generated method stub
         }//end of removeEdge
    //////////////////////// end of graph class ////////////////////
    ///////////////////driver////////////////////////
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.StringTokenizer;
    * This class reads a text description of a metro subway system
    * and generates a graph representation of the metro.
    *<p>
    * The grammar for the file is described below in BNF. A typical line
    * in the file looks like this :
    * <code> 20 NorthStation Green 19 22 Orange 15 22 </code>
    * where :
    * 20 is the StationID
    * NorthStation is the StationName
    * Green 19 22
    * Green is the LineName
    * 19 is the StationID of the outbound station
    * 22 is the StationID of the inbound station
    * Orange 15 22 is a LineID in which :
    * Orange is the LineName
    * 15 is the StationID of the outbound station
    * 22 is the StationID of the inbound station
    * Therefore, NorthStation has two outgoing lines.
    * note : 0 denotes the end of a line : i.e. in this case,
    * OakGrove would be at the end of the line, as there is no other outbound
    * station.
    *<p>
    * metro-map ::= station-spec* <BR>
    * station-spec ::= station-id station-name station-line+ <BR>
    * station-id ::= (positive integer) <BR>
    * station-name ::= string <BR>
    * station-line ::= line-name station-id station-id <BR>
         public class MetroMapParser {
              private BufferedReader fileInput;
              static AMGraph graph = new AMGraph();
              LinkedList l = new LinkedList();
              public static void main(String[] args){
                   if(args.length != 1){
                        usage();
                        System.exit(0);
                   String filename = args[0];
                   try{
                        MetroMapParser mmp = new MetroMapParser(filename);
                        mmp.generateGraphFromFile();
                   catch(Exception e){
                        e.printStackTrace();
              private static void usage(){
                   //prints a usage message to System.out
                   System.out.println("java ex3.MetroMapParser <filename>");
              * @effects: creates a new parser that will read from the file
              * filename unless the file does not exist. The filename should specify
              * the exact location of the file. This means it should be something like
              * /mit/$USER/6.170/ex3/bostonmetro.txt
              * @throws java.io.IOException if there <tt>filename</tt> cannot be read
              * @returns a new MetroMapParser that will parse the file filename
              public MetroMapParser(String filename) throws IOException{
                   //     a buffered reader reads line by line, returning null when file is done
                   fileInput = new BufferedReader(new FileReader(filename));
              * @effects: parses the file, and generates a graph from it, unless there
              * is a problem reading the file, or there is a problem with the format of the
              * file.
              * @throws java.io.IOException if there is a problem reading the file
              * @throws ex3.BadFileException if there is a problem with the format of the file
              * @returns the Graph generated by the file
              public void generateGraphFromFile()
                   throws IOException, BadFileException{
                   String line = fileInput.readLine();
                   StringTokenizer st;
                   String stationID;
                   String stationName;
                   String lineName = null;
                   String outboundID = null, inboundID = null;
                   while(line != null){
                        st = new StringTokenizer(line);
                        //          We want to handle empty lines effectively, we just ignore them!
                        if(!st.hasMoreTokens()){
                             line = fileInput.readLine();
                             continue;
                        //from the grammar, we know that the Station ID is the first token on the line
                        stationID = st.nextToken();
                        if(!st.hasMoreTokens()){
                             throw new BadFileException("no station name");
                        //     from the grammar, we know that the Station Name is the second token on the line.
                        stationName = st.nextToken();
                        graph.addNode( stationName, stationName, stationID );
                        if(!st.hasMoreTokens()){
                             throw new BadFileException("station is on no lines");
                        while(st.hasMoreTokens()){
                             lineName = st.nextToken();
                             if(!st.hasMoreTokens()){
                                  throw new BadFileException("poorly formatted line info");
                             outboundID = st.nextToken();
                             if(!st.hasMoreTokens()){
                                  throw new BadFileException("poorly formatted adjacent stations");
                             inboundID = st.nextToken();
                             //working like this although print edgelist appears to be going into infinite loop
                             graph.addEdge( graph.getGNode( stationID ) , graph.getGNode( outboundID ), graph.getGNode( inboundID ), outboundID, inboundID, stationID, lineName );
                        line = fileInput.readLine();
    //////////////////end of driver//////////////////
    /////////////// this is the info I'm testing put in a txt file//////////
    1 M               Blue 5 3 Red 2 5
    2 N               Blue 4 1
    3 O               Blue 1 5 Red 0 4
    4 P               Blue 5 2 Red 3 5
    5 Q               Blue 1 4 Red 3 2
    ////////////////end of txt file///////////////////

    that didn't come out to well - try again
    Help Having a problem with my directed graph, and its been frying my head. from the test that I've ran ita ppears to be working sort of the problem that I'm having is once I've created a node, I then attach an edge to that node, however where there are multiple edges it will only attach the last edge that it comes to. I'm creating a list of nodes, then trying to attach a list of edges to that particular node. code listing - theres a lot, sorry
    //////////////////// graph class ///////////////
    //: AMGraph.java
    /************************* Revision History *************************
    *     v1.0 - Initial version:
    public class AMGraph implements IAMGraph {
         //2D-Array of graph nodes
         protected Gnode firstNode, node;
         //graph edges
         protected Gedge firstEdge, edge;
         private int gSize;
         /////////////// Constructor ///////////////
         public AMGraph(){
              firstNode = null;
              firstEdge = null;
              gSize = 0;
         /////////////// Accessors ///////////////
         public boolean isEmpty() {
              if ( firstNode == null){
                   return true;
              return false;
         }//end of isEmpty
         public boolean hasNeighbour() {
              // TODO Auto-generated method stub
              return false;
         }//end of hasNeighbour
         public int outDegree() {
              // TODO Auto-generated method stub
              return 0;
         }//end of outDegree
         public int inDegree() {
              // TODO Auto-generated method stub
              return 0;
         }//end of inDegree
         public void findPath(Object outBound, Object inBound) {
              // TODO Auto-generated method stub
         }//end of findPath
         public void printStationList(){
              Gnode temp = node;
              while( temp != null ){
                   System.out.println( temp.getID()+" "+temp.getStationName() );
                   temp = temp.getNextNode();
         }//end of printStationList
         public void printEdgeList( Gnode source ){
              Gedge temp;
              temp = source.getNextEdge();
              while( temp != null ){
                   System.out.println( temp.getStationID()+" out "+temp.getOutBound()+" in "+temp.getInBound() );
                   temp = source.getNextEdge();
         }//end of printEdgeList
         * @return
         public int getOutDegree ( ){
              int degree = 0;
              while( node != null ){
                   degree = node.getOutDegree();
                   node = node.getNextNode();
              return degree;
         }//end of getOutDegree
         * @param data
         * @return
         public Gnode getGNode ( String data ){
              Gnode temp = node;
              while( temp != null ){
                   if( temp.getID().equals(data) ){
                        return temp;
                   else{
                        temp = temp.getNextNode();
              return null;
         }//end of getGnode
         public boolean containsEdge( Gnode node0, Gnode node1) {
    Gnode source = node0, dest = node1;
    Gedge tempEdge = source.getNextEdge();
    while ( tempEdge != null){
         if ( tempEdge.getOutBound().equals( dest.getID() ) ){
              System.out.println("true");
              return true;
         else{
              tempEdge = tempEdge.getNextEdge();
    System.out.println("false");
    return false;
         }//end of containsEdge
         /////////////// Transformers ///////////////
         public void addNode( Comparable data, Object stationName, Object stationID ) {
              node = new Gnode( data, stationName, stationID );
              if ( firstNode == null ){
                   firstNode = node;
              else{
                   node.setNextNode( firstNode );
                   firstNode = node;
    gSize++;
         }//end of addNode
         public void addEdge( Gnode source, Gnode oBound, Gnode iBound, Object outBound, Object inBound, Object stationID, Object lineName ) {
    Gnode s = source;
    Gnode o = oBound;
    Gnode i = iBound;
    edge = new Gedge( s, o, i, outBound, inBound, stationID, lineName);
    /*works sort of*/
         s.setNextEdge( edge );
         edge.setNextEdge( s.getNextEdge() );
    /*finish working here sort of*/
         }//end of addEdge
         public void removeNode(Comparable data) {
              // TODO Auto-generated method stub
         }//end of removeNode
         public void removeEdge(Comparable data) {
              // TODO Auto-generated method stub
         }//end of removeEdge
    ////////////// end of graph class////////////////

  • How to display a 'Directed Graph Structure' in ADF

    Hi
    I have a requirement where I have to display a 'Directed Graph Structure' (one with multiple nodes and links ). http://flylib.com/books/en/2.264.1.159/1/
    As of now there is no dvt component to support it.
    So I used a third party JS lib to draw the graph in HTML.
    Now I want to open this HTML page as pop in my adf application using JS.
    Please suggest me how to do that or any alternative way to display the graph structure.
    Thanks

    is there another way? or is it just not possible?
    gr
    Joeri

  • Detecting Cycles in a Directed Graph

    Can somebody help me how to find cycles in a directed graph,
    I already made a Depth First Search code and base on what I've learned Cycles can be done using Depth First Search
    public static void DFS(int numberNodes){
        System.out.print("Enter starting node for Depth First search: ");
            int v = scanner.nextInt();
        for(int i = 1;i<=numberNodes;i++)
                 visited[i] = false;
            dfs_rec(v,numberNodes);
        }//end DFS()
         public static void dfs_rec(int v,int n){
        int i;
        visited[v] = true;     
             System.out.print(" "+v);
             for(i = 1;i<n;i++)
                  if(adj[v] == 1 && visited[i] == false)
                   dfs_rec(i,n);
         }//end dfs rec                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    malcolmmc wrote:
    paulcw wrote:
    I don't see the need for unsetting the flag. Visited is visited. What needs to be added is to respond when the flag is set to true.You need to clear the flag because the same node might be reached through more than one route without the graph being cyclic (it could be a shared sub-tree).
    Only if you encounter a node which is already part of the path you're examining have you found a loop.But not if it's a depth-first search, no?
    Oh, I see what you're saying. Set the flag, do a depth-first search, then when you exhaust that and do a sibling, clear the flag. OK.

  • Has Sun fixed the direct draw and direct X problems?

    I have been looking at the bugs and forums lately and have not seen anywhere that Sun has fixed the direct draw and direct X problems. I disabled these options a while back but would like the performance of direct draw back. Here are the flags I am talking about.
    System.setProperty("sun.java2d.ddoffscreen", "false");
    System.setProperty("sun.java2d.noddraw", "true");
    I want my native performance back.
    Any news?
    Thanks,
    Pat

    Quote
    dxdiag shows agp texture accel. to be not available
    I had that same thing happen on an older system while using a GF2 MX and a NIC card in the top PCI slot. I discovered the AGP and top PCI were "shared" on that mobo. Moving the NIC to another slot resolved the issue.

  • Report 10g graph problem

    i have a problem in graph wizard in reports 10g
    when i want do display more than 3 diferent data in plot areao of graph wizard only first 3 rows can be seen and adjusted, others can not.
    is there a way to see and adjust more then 3 rows in plot area?
    Thanks,
    Rade

    Hi,
    Not directly. You have to edit graph.xml file (in property pane of your graph). Some details about this file you can get from How to... topics on Products page
    have a good day
    Daniel

  • Excel & ActiveX: Insert arbitrary columns from 2D array and create graph problems

    Hi there,
    I want to insert data from either a 1D or 2D array from LabView into Excel and create graphs.
    I used the information from the following example:
    http://www.ni.com/example/28934/en/
    and was able to create a new Excel file (I'm using Excel 2010), writing data from an 1D array to a column in excel by creating a while loop and using the first element of the array to write it to a specific cell. I use the counter of the loop to write to the next cell when the loop starts over and always delete the first value, which I write to the cell, from the array until it is empty.
    Now I also would like to write a 2D array - so the first column in Excel should be the first column from the array and so. Here I cannot use the loop counter directly as Excel only counts 1,2,... for the rows, but uses A,B,... to count columns. Also I do not know in advance how many columns my 2D array will contain, so creating a lookup table like (A means 1, B means 2,...) is not really an option (except there really is no other way). Is there a possibilty to convert numbers into letters or some way to 'explain' to the program that column 2 in the array means column B in Excel for example, or is there a way to insert new columns?
    I figured out how to add new Worksheets and as I also need to create a certain number of Worksheets and I know that on standard 3 sheets are present when creating the file, I use the 'add' methode to create every new worksheets before worksheet 3 - I could use the same methode to create new columns in Excel, but so far I didn't find a methode to do so. Or is there a way to enter the whole 2D array at once?
    Then I'd like to create a graph (in case of the 1D arrays a bar plot, when using 2D arrays a 3D plot) to view the data. I found this example:
    http://www.ni.com/newsletter/51339/en/
    -> as I do not have the toolkit I'd like to do it using ActiveX directly, so I tried to do things like shown under the headline 'DIY ActiveX/.NET'
    I tried to load the snippet to a new Excel file but got the error message 'microsoft.office.interop.excel.dll not found' and hence the code is not working. That confuses me a little as I would guess when this dll is not present I cannot access Excel from LabView at all, though my understanding of what I'm really doing so far is quiet limited. ;-)
    Also - as far as I understand from the snippet - when creating a new chart object I should be able the create methodes for it, however when I do a right click on the chart object of an ActiveX Worksheet symbol there are none listed.
    To explain my problems better I added a snippet showing my two problems: The inner of the two while loops shows how I import a 1D array. In the outer loop I seperate the columns. I know that currently this is not working as all data end up in column A of the Excel sheet - so I would need to convert the number of the outer counter to A, B,... or find a different solution.
    Moreover on the snippet I placed an ActiveX Worksheet Property with the Chart Object - as I can see the difference to the Chart Object in the example code from the last link above is the color. However I'm not sure what that means and how to change/ solve this.
    And just to make sure - I know this way the VI does not run as the Chart Object is placed completely wrong - I just did it, so it is included in the snippet.
    I'd be thankful for any suggestions,
    Thanks!
    Solved!
    Go to Solution.
    Attachments:
    ExcelAreaScan.png ‏60 KB

    Hello everyone and thanks for the answers.
    I only have the LabView Student Edition available here - is the toolkit included in it too. How can I check if it is installed/ available and in case it is installed - where can I find it?
    Today I had time to take a look at the example
    Create via ActiveX Labview a XY Scatter plot graph on an excel sheet
    It almost does what I want in terms of creating a graph. The only problem I could not fix, is that in this example a sheet is created where only the graph is present. i'd like to add the graph to a previously created worksheet. Today I tried get this working but it seems I stilll don't really understand what I'm doing, I'll post a snippet of my code as soon as I can access the PC with LabView on it again.
    I also took a look at the other example for inserting 2D attays - it seems to be what I need, I just had no time so far to test it, I'll post an update when I could test it.
    Thanks for the help so far!

  • One-to-many graph problem

    Hi,
    I am haviing a crystal report problem. The problem relates to a one-to-many relationship involving two tables.
    I have a similar setup to the following:
    I have 2 database tables: table1 & table2
    table1 consists of 3 fields:
    {id#}, {yes/no},{up/down}
    table2 consists of 2 fields:
    {id#},
    the field can contain any of the following values: 'open', 'closed', 'final', 'complete'.
    The problem is that there exist many states to one id#.
    I have a bar graph in my report that displays a bar for the count of the{yes/no} field and a bar for the count of the {up/down} field. I want also a bar for the count of when the field = 'final'.
    What happens when I write a formula for the field in the second table and place it in the 'show values' section of the chart expert, is the count displayed in each bar on the graph increases significantly. I am assuming this is because there are multiple records in table 2 for each record in table 1.
    What I want to happen is that the graph displays bar 1 and bar 2 correctly and then when I put in the formula for the third bar, it simply displays that bar with the count for when the field = 'final'. I dont want it to affect the whole garph.
    Has anyone got any suggestions on how I can do this?
    I have tried messing around with the distinct records setting in crystal and also by writing an sql query specifying DISTINCT keyword instead of using the select expert, but to no avail.
    Please please can someone help me with this issue.
    Thank you.
    J

    You can add a 1-1 query key through the code API in a descriptor amendment method. You could also define a selection criteria on the 1-m mapping to filter the type=2.
    Example: (see Foundation Library manual 8-17)
    OneToOneQueryKey queryKey = new OneToOneQueryKey();
    queryKey.setName("organization");
    queryKey.setReferenceClass(Organization.class);
    ExpressionBuilder builder = new ExpressionBuilder();
    queryKey.setJoinCriteria(builder.getField("ORGANIZATION.ORG_ID").equal(builder.getParameter("RELATIONSHIP.PARENT_ID").and(builder.getParamater("RELATIONSHIP.RELATIONSHIP_TYPE").equal(2)));
    relationDescriptor.addQueryKey(queryKey);
    Example: (of 1-m mapping with selection criteria)
    OneToManyMapping mapping = new OneToManyMapping();
    mapping.setReferenceClass(Relation.class);
    mapping.setTargetForeignKey("RELATION.PARENT_ID");
    ExpressionBuilder builder = new ExpressionBuilder();
    mapping.setSelectionCriteria(builder.getField("RELATIONSHIP.PARENT_ID").equal(builder.getParameter("ORGANIZATION.ORG_ID").and(builder.getField("RELATIONSHIP.RELATIONSHIP_TYPE").equal(2)));
    orgDescriptor.addMapping(mapping);

  • Xy Graph problem

    I have one XY graph, in that i am drawing graph according to the values from inputfile. it is drwaing properly from left to right. But after some time another curser is removing my graph.Why it is happening?
    Attachments:
    string.vi ‏105 KB
    input.txt ‏113 KB

    Seems to work for me. I don't see any problem with cursors. Try the attached - slightly modified. Your file contains about 3500 points, so I set the buffer length to 3500. Also, make sure to reset the buffer on first iteration, otherwise "old" data is retained.
    I moved the Axis properties out of the loop. It seems to improve the display.
    It seems your x axis wraps around a couple of times, but that's a result of the data, not the plotting technique.
    Attachments:
    string_mod.vi ‏126 KB

  • Labview Graph Problem

    Hello,
    I have a problem with a tool witch takes excel columns and plots graphs.
    The problem is that when i create the png of the graph it additionaly appears the poit (0;0) witch should be on graph.
    In the preview i can't see this point. I attached an example.
    Attachments:
    Daimler Star22_unknown_unknown_unknown_ACCX_Offset vs temp.png ‏13 KB

    Have you tried putting a probe onto the data going into the graph to check there aren't any extra data points (i.e. at 0,0)?
    Certified LabVIEW Architect, Certified TestStand Developer
    NI Days (and A&DF): 2010, 2011, 2013, 2014
    NI Week: 2012, 2014
    Knowledgeable in all things Giant Tetris and WebSockets

  • Line graph problem in numbers

    How can I change. the thickness of lines when using the line diagram in numbers. I want to see 3 lines that are relatively close to each other but because they are very thick they overlay each other.

    There isn't a way to change the shape. Your options are to change the graph type, or to make the graph larger (should correct the overlap problem).

  • Line Graph Problem when used with Series

    I am facing a problem with Line Graph in Oracle Reports 10g.
    I have made a graph having series of three curves.
    The graph is perfect when all series have similar X-Axis values. See the link
    http://www.sysautomation.com/ask/RPT_LINE_GRAPH_OK.PDF
    But same graph does not print curves properly, gives spaces in the curves, when all the series do not have similar values on X-Axis
    http://www.sysautomation.com/ask/RPT_LINE_GRAPH_NOT_OK.PDF
    Pl. guide me what to do to make this graph working.

    Thanks for reply.
    In my case, I have to plot curves.
    and some Series have different X-axis values.
    I have no choice, but to plot them.
    The same thing was working fine with Reports 6i + Graphics 6i.
    What is Scatter Plot?
    Thanks again.
    This is a limitation in the current line graph in
    Reports 10g (9.0.4). I can't recall whether this has
    improved in 10.1.2 or it was planned for the next
    rev.
    Would trying a scatter plot be better?
    Line graphs are normally meant for regular intervals
    on x-axis, so using the example of dates, Jan, Feb
    and Dec would be placed right next to each other,
    rather than scaled with the right distance between
    Feb and Dec.

  • Graphing problem with two plots

    I know how to plot two graphs on top of one another but the problem I have
    is as follows. I have the spectrum of a certain noisy signal which has been
    averaged. I then change some conditions by pressing a button and the
    spectrum changes to something else. of course I can capture both of these
    graphically but really I want them both on the same graph - any ideas?
    The data is not available at the same time - would I have to store it
    somewhere in a buffer and recall it in some way? Picture a spectrum analyser
    where there are two channels - you take the spectrum on channel A and then
    store it. You then take the spectrum on channel B and do a comparison where
    they appear together - this is my problem in essence.
    thanks
    tom

    If both writes to the graph occur in the same loop ( just at different iterations), use shift registers. (See attached simple LabVIEW 7.0 example).
    If the writes occur in different parts of the diagram, Just write the first channel to a local variable of the graph, then later combine the two channels for the final graph.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    2Channel.vi ‏46 KB

  • SVG Graph problem

    I have an SVG graph with 2 series and I have 2 check boxes (let me call them Series1 and Series2 for this example) that control the display of this series. When I check Series1 , only the first series is to be displayed and on checking on series2 , the 2nd is to be displayed, if both are chcecked, both the series are displayed on the same SVG chart.
    This actually works well but the problem is that if series 2 is checked without checking series 1 only a shadow of the series 2 is displayed, I guess the SVG chart attributes determining the X,Y coordinates and labels are not being invoked. However , if series 1 is checked it is displyed correctly, a proper chart with only Series 1, and if both are checked, it displays it correctly too. But if only Series2 is checked I get a shadow of the series against a white background, though the shape of the series output is right. The graph background, the legend, the X,Y corordinates etc are missing.It looks like the chart attributes are determined from the first series and so if that is not invoked, only a shadow if the other series are displyed. Can anyone help with this?
    Thanks

    i see what you mean re the second series depending on the first. i've logged it as a bug, too, thanks. consider working around the issue for now by setting up multiple svg regions on your page that fire conditionally based on the series to be shown. so for your example case you could have three regions - one for series1, one for series2, and one for both. you could then show the appropriate region based on whether series1, series2, or both series are to be displayed.
    hope this helps,
    raj

Maybe you are looking for

  • How to make compiler do inline optimization in WTK?

    Hello: I'm a freshman in WTK. I found that my project is running very slow, so I wrote the following test to find the time cost of function call. I found that in this test, it spent 94ms, 1076ms and 2016ms in simulator, for 0, 1, and 2 function calls

  • Authorizing on replacement PC

    My computer crashed and I'm setting up a new one. ADE won't let me authorize my new PC because my ID has been previously used (on the computer that crashed.) I don't want to establish a new ID ... prefer to keep using my primary ID. How do I get ADE

  • EQUIPMENT replication to CRM from ECC

    Hi,   Appreciate, if some one can help me in solving my issue with EQUIPMENT Master.     Below is the procedure I followed to replicate EQUIPMENT Master       Through R3AC1 transaction EQUIPMENT object is filtered for one equipment number.      Adapt

  • Can anyone at all answer this?

    My shared folder is missing.  I'm running Mac OSx 10.5.8. Is there any way to create a new one and what would be the best way to do that. Thanks in advance

  • Wendecover erstellen

    Schönen Abend. Ich habe ein Problem und finde einfach keine Lösung dazu.. Ich muss ein Magazin erstellen mit 40 Seiten. Aber ab der hälfte soll sich das ganze auf den Kopf stellen. Ich habe schon versucht das Dokument in 2 Teile zu teilen und habe de