Data handling and graphs

I originally wrote the graph program to handle the data in a text file that was organized like this...
vertex a
vertex b
vertex c
vertex d
edge a c
edge a d
edge d b
and now I have to change the main to accept a datafile containing...
a b
b c
c e
d g
g c
Now, here is a copy of the main program as it currently stands...
import java.io.*;
import java.util.*;
public class TopSort
     static Graph theGraph = new Graph();
     static Hashtable hashList = new Hashtable();  //just to store array index
     public static void main (String args[])
             MyInfoachaffin myInfo = new MyInfoachaffin();
          myInfo.info();     
             File sourceFile = new File(args[0]); // access the file
             if (sourceFile.exists() == false)                                          
               System.err.println("Oops: " + sourceFile + ": No such file");
               System.exit(1);
             String newVertex, startEdge, endEdge;
             int arrayPosition = -1;
             try //open the file
                       FileReader fr = new FileReader(sourceFile);
                       BufferedReader br = new BufferedReader(fr);
                    String input;
                    while ((input = br.readLine()) != null)
                         StringTokenizer toke = new StringTokenizer(input);
                            while (toke.hasMoreTokens())
                              if (hashList.containsValue(toke))
                                           return;
                                 else
                                      newVertex = toke.nextToken(); //get vertex
                                      theGraph.addVertex(newVertex); //add into graph
                                      arrayPosition++; //increment counter
                                      hashList.put(newVertex, new Integer(arrayPosition));
                                      //add position with vertex as key
                                 /*else if (toke1.equals("edge"))
                                      startEdge = toke.nextToken(); //get edge
                                      endEdge = toke.nextToken();  //get vertex
                                      Integer temp = ((Integer)hashList.get(startEdge));
                                      int start = temp.intValue(); //find position with key
                                   Integer temp2 = ((Integer)hashList.get(endEdge));
                                      int end = temp2.intValue();  //find position with key
                                      theGraph.addEdge(start, end); //add edge
                            }//close inner while
                   }//close outer while
                   System.out.println("The hashtable contents: " + hashList.entrySet());
                    br.close();
              }//close try
                  catch (IOException e)
                            System.out.println("Whoops, there's a mistake somewhere.");
                      theGraph.graphSort();
   }//end main
}//end class I have managed to seperate the vertexes from the edges and stored them in a hashtable so as to be able to remember their location in the array itself. My question is is there a way to go through a file a second time and pull the vertexes from that file or, conversely, should I store the data in the file into, oh I dunno, a linked list or something that I can pull the data from? The graph part of the program works so I didn't add that file and the setting the vertexes works fine too...I'm just stuck on how to handle the edges, exactly, so does anyone have any advice? Right now, the adding edges is commented out because that was how I handled it with the original data...

Whoa, you're freakin' me out.
All you gotta do is read in the data in a new format. You can either translate the new format to the old format, or you can write a method that creates objects from the new format explicitly. That's all there is to it.

Similar Messages

  • Data Visualization and Graphs for JSF

    Are the Data Visualization and Graphs for JSF included in this release. I saw the demo here http://www.oracle.com/technology/products/jdev/11/index.html and want to try it out. But I could not seem to access it in the tool.
    Regards
    Orlando Kelly
    Cayman Islands Government

    <p>
    Hi,
    </p>
    <p>
    It seems you have no suitable libraries in your ViewController project. See on this image whet libraries you need.
    </p>
    <p>
    Kuba 
    </p>

  • Help In keithley 2400 VI!!(Problem with the data logging and graph plotting)

    Hi,need help badly=(.
    My program works fine when i run it,and tested it out with a simple diode.The expected start current steps up nicely to the stop current.The only problem is when it ends,i cannot get the data log and the graph,though i already have write code for it.Can someone help me see what's wrong with the code?I've attached the necessary file below,and i'm working with Labview 7.1.
    Thanks in advance!!!
    Attachments:
    24xx Swp-I Meas-V gpib.llb ‏687 KB

    Good morning,
    Without the instrument it might be hard for others to help
    troubleshoot the problem.  Was there a
    specific LabVIEW programming question you had, are you having problems with the
    instrument communication, are there errors? 
    I’d like to help, but could you provide some more specific information
    on what problems you are encountering, and maybe accompany that with a simple
    example which demonstrates the behavior? 
    In general we don’t we will be unable to open specific code and debug,
    but I’d be happy to help with specific questions. 
    I did notice, though, that in your logging VI you have at
    least one section of code which appears to not do anything.  It could be that a small section of code, or
    a wire was removed and the data is not being updated correctly (see pic below).  Is your file being opened properly?  Is the data being passed to the file
    properly?  What are some of the things
    you have examined so far?
    Sorry I could not provide the ‘fix’, but I’m confident that
    we can help.  Thanks for posting, and
    have a great day-
    Message Edited by Travis M. on 07-11-2006 08:51 AM
    Travis M
    LabVIEW R&D
    National Instruments
    Attachments:
    untitled.JPG ‏88 KB

  • Xbee data extracting and graphing

    Hi,
    I have been trying for a few days to get this to work with no results. I have searched through google and some of the forums for help with nothing that really helped.
    I am using two xbee devices to transfer data to labview to graph.Eventually I would like to use the ADC on the Xbee to take an analog signal and convert it to a digital signal for labview to read and so I can do my analysis on it. I started with getting a basic Visa program to work and send number from my arduino uno over and over again and placing those values into an array This works great with no problems. The problem comes when I try and send a signal through the Xbee. 
    I tried to send an analog signal out to the adc and I was getting some values in labview in Hex but I was unsure what they really meant. My second attemp was just to try and create a pulse wave using my arduino and send that to labview and have labview try and graph the incoming signal. This however did not work and I am not getting any data. I connected both Xbees up on a bread board without labview to see if I can get the a signal out of the recieving xbee and it worked. So the problem should not be with my xbee's but with my code. 
    The code is where I am not sure about. I was able to find examples of how to use the visa and was given a basic example of it. I have then tried to manipulate the program to see if ti would work for me. I am trying to take the signal from the VISA Read funciton and convert it to a 1d array to display on a graph. I have also tried to seperate the dat into an array char by char from the string. However, none of this worked. I am getting a zero value out for my graph and no values into my array. I am also getting no value into my READ String area. 
    The values I have sometimes gotten look like:
    00\00\00\00\00\94\00\00\ and so on with different value. Some time the byte read is very large up to 475 when I am placing the pulse wave in or so and sometimes smaller at 19 when I tried to connect the ADC.
    I have attached some of my VI's to see if anyone can come up with a better way or point me in a better direction.
    The png is a pic of the results I got from the pulse input. So it looks like I am not getting any data at all. 
    Thanks for the help
    Juan
    Attachments:
    Basic VISA_Test_1.vi ‏26 KB
    Result_OfpulseWave.png ‏129 KB

    Hello jrod03,
    I would suggest using the NI LabVIEW Interface for Arduino Toolkit found here (http://sine.ni.com/nips/cds/view/p/lang/en/nid/209​835) and posting your Arduino related questions in our LabVIEW Interface for Arduino community (https://decibel.ni.com/content/groups/labview-inte​rface-for-arduino).
    This document will also probably be helpful to you (http://digital.ni.com/public.nsf/allkb/8C077471896​06D148625789C005C2DD6).
    Jonathan L.
    Applications Engineer
    National Instruments

  • Webforms - data handling and storage

    Hello,
    I would like to know what is the best recommended practice / best apps methodology for the following scenario :
    A Custom web form with options to enter data, add attachments and submit. On submission , the workflow gets triggered, followed by approvals and finally data update into the relevant transaction.
    My query :
    - > For saving the form data and attachments , the options which I am aware are :
    1 )  tables
    2) case management, into the transaction using GOS.
    3) DMS
    4 ) Workflow container
    5) Business document services
    Any more to add to this list would be really good.
    In such scenario , what are the best possible way to be used ?
    Would be good to hear your thoughts on this.
    Thanks alot
    Saujanya

    HI,
    In one of my projects we also had a similar kind of scenario the below was teh approach we tried and it worked.
    1. Store all the relevant data fields Header and Item level data in the table and also maintained relation ship between these two tables.
    2. Now when it comes to attachment first we created a unique guid for each attachment and the relevant document we tried to store in the DMS system. so when ever we require teh document then we use to rfer the GUID which was generated.
    3.AS usual when he clicks on subit we tried to create a custom business class and rasied the event through SAP_WAPI_CREATE_EVENT.
    4. If attachment is required in the workflow then we use to refer in tables.
    May be it might help you to start...... Have a great day
    Regards
    Pavan

  • 4503/4506 - data handling and data flow

    I have been tasked to find a document that details how, from start to finish, a packet goes through a 4503/4506 unit. I'm talking a level of detail that includes what portion of RAM the packet goes into once it hits the inbound interface, what parts of the switch handle the analysis (ACLs, et all), and so on, right until the packet is either dropped or forwarded to the outgoing int. As detailed a description as possible, and if a non-model-specific equivalent is available and applicable to this unit, that works as well.
    I have been looking through the TechDocs and the like, as well as several attempts at Google (which is well-nigh useless), and no luck thus far.
    Thanks in advance for any information provided.

    I am not aware of any CCO documents explaining path of a packet/CAT4500 architecture. However, there was a presentation on this at Networkers 2005. If you attended it, you can check it out at
    http://www.cisco.com/networkers/nw05/nwol.html
    Here is the session information for RST-4500.
    Session Title: Cisco Catalyst 4500 Switch Architecture
    Length: 2 Hours
    Level: Intermediate
    Related Sessions:
    RST-3031 Troubleshooting LAN Protocols
    RST-3042 Troubleshooting Cisco Catalyst 4000 and 4500 Series Switches
    Abstract: This session presents an in-depth study of the architecture of the Cisco Catalyst 4500 Switches and how the various components work together. The focus for this session is present information to help the audience understand the architecture to be able to design and implement Catalyst 4500 in their network and troubleshoot better.
    Topics include a discussion of the architecture, information about the latest Cisco Catalyst 4500 supervisors and switching modules such as SupevisorV-10GE, Netflow Feature card (NFL), Catalyst 4948, Supervisor II+TS amd PoE linecard, as well as the key features such as CEF/Multicast Forwarding, DHCP Snooping, IP Source Guard, Dynamic ARP inspection, 802.1X, Redundancy (SSO), Netflow, ACL/TCAM, QoS (Per-port/Per-VLAN and UBRL),
    This session is designed for network designers and senior nework operation engineers considering deploying or have Cisco Catalyst 4500 series of switches in enterprise and service provider networks.
    * Prerequisites:
    1. Knowledge of LAN protocols is required
    2. Basic understanding of Cisco Catalyst switches is required.
    Topics include a discussion of the architecture, information about the latest Cisco Catalyst 4500 supervisors and switching modules such as SupevisorV-10GE, Netflow Feature card (NFL), Catalyst 4948, Supervisor II+TS amd PoE linecard, as well as the key features such as CEF/Multicast Forwarding, DHCP Snooping, IP Source Guard, Dynamic ARP inspection, 802.1X, Redundancy (SSO), Netflow, ACL/TCAM, QoS (Per-port/Per-VLAN and UBRL),
    Speakers: Balaji Sivasubramanian
    Escalation Eng
    Cisco Systems
    Balaji Sivasubramanian is an escalation engineer in Cisco's Gigabit Switching Business Unit. Balaji, who is a CCNP, is also co-author of "CCNP Self-Study: Building Cisco Multilayered Switched Network - 2nd Edition" (ISBN -1587051508). Balaji is an expert in Catalyst 4500 switches architecture, and in troubleshoooting LAN protocols and Catalyst switches including the Catalyst 4500, Catalyst 6500 and Catalyst 3500. In his 5+ years with Cisco, Balaji has also held positions of TAC Technical Leader/Expert in LAN/Campus switching, Worldwide Subject Matter Expert in LAN technologies for the Cisco TAC and a TAC support engineer in LAN/Campus switching.

  • Bridge meta data handling and filtering

    It would be great if you could add two features:
    1.  adding keywords to multiple files currently if two files share the same  keywords but not in the order, adding new is impossible without  overwriting the existing keywords
    2. filtering by location data, it would be great to filter by country say, just as by keyword, date or other.
    Thanks, Erik

    For adding keywords without removing existing keywords, this script might be of use to you...
    http://www.ps-scripts.com/bb/viewtopic.php?f=19&t=2364&sid=57a50afd1b53b5fc195f0e5dfdbfab0 6

  • A message will pop up (Exc in ev handl: Error: Bad NPObject as private data!) and the tab I was on will close out and reopen in a new window. Why is it happening and how do I stop it?

    Okay, I will have a window open with 4 tabs open. At first, everything is fine, but after a day or so, a message will pop up on screen saying "'''Exc in ev handl: Error: Bad NPObject as private data!'''" and after you close it out, the tab you were on will close and reopen in it's own window. I then have to shut down all both old and new windows and open a new window with my original 4 tabs again. It will work fine until a few days pass and it starts over again.

    This issue can be caused by the McAfee Site Advisor extension
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode

  • How to save data on a graph and then add new data to it

    i am currently plotting data on a graph from a physical system. However when i want to add new data to the plot, the old one is replaced. I am trying to do more than one plot on the same graph, where the incoming data is at different times. I want something like Excel where i can just add a new plot to the graph.Can i save the data or freeze it onto the graph or something so that i can add a new plot and see the two at the same time?

    > i am currently plotting data on a graph from a physical system.
    > However when i want to add new data to the plot, the old one is
    > replaced. I am trying to do more than one plot on the same graph,
    > where the incoming data is at different times. I want something like
    > Excel where i can just add a new plot to the graph.Can i save the data
    > or freeze it onto the graph or something so that i can add a new plot
    > and see the two at the same time?
    As the other post pointed out, there are two objects in LV for plotting,
    graphs and charts. If you wish to have a chart recorder that
    accumulates data into one or more plot with time, you probably want a chart.
    If you push a button and acquire a trace and want to add that to your
    graph, you just need to
    combine it with the data you plotted before and
    update the graph. It isn't the most efficient, but you can easily read
    the value of the graph using a local, add another row or column or
    element to your data and send it to the graph.
    To directly answer your other question, no, the grah doesn't have a
    functional interface for clearing, adding, or deleting plots. Instead,
    you do that with the diagram nodes and give the graph the results.
    Greg McKaskle

  • UIX with XSQL as XML data provider and event handler

    Hello ,
    I would like to bind XML data to messageinput elements of a form element
    as values to be presented before entering (data provider)
    as well as input values to be persisted after completing the form (event handler).
    My impression (as a newbee) is that only for BC4J integration there is a bidirectional binding with view objects.
    Can i use 'include' to bind a static xml file as data source for output?
    How can i use XSQL to be bound as data for input as well as for output of a form?
    A last question concerning a page with 3 tabs:
    do i need 3 different pages and requests to get the data of the 3 tabs
    or is it possible to get the whole data of the page in one request
    and distribute it over the 3 tabs.
    Any help appreciated
    Thanks
    Klaus Dreistadt

    You could do this, but we don't provide any tools to make this easy.
    You'd have to write an implement of the DataObject interface
    that gives your UI access to the XML document, and write custom
    event handlers to perform the "set" side of things. The Data Binding
    and UIX Controller chapters of the UIX developer's guide will give you
    a high-level view of how to accomplish this, but nothing specifically
    about reading or writing to XML documents.

  • Can't pull the yellow handles in Graph Editor up and down

    I'm trying to fidn a solution for over an hour already.
    I can't pull the yellow handles in Graph Editor anywhere like I see it in all the Tutorials. I can only pull it left or right and make it longer or shorter. But when I try to pull it up, the entire point will go up as well.

    Thanks a lot for an answer Appreciate it.
    No but.. it doesn't work on any.. tried the value graph, speed graph.. or whatever.. I tried it all and none of them worked.... mhh..
    Tim

  • Can I use an OLE DB Command Task to call a parameterized stored procedure, perform some data editing and pass variables back to the SSIS for handling?

    I am using a Data Flow and an OLE DB Source to read my staged 3rd party external data. I need to do various Lookups to try and determine if I can find the external person in our database...by SSN...By Name and DOB...etc...
    Now I need to do some more data verification based on the Lookup that is successful. Can I do those data edits against our SQL server application database by utilizing an OLE DB Command? Using a Stored Procedure or can I sue straight SQL to perform my edit
    against every staging row by using a parameter driven query? I'm thinking a Stored Procedure is the way to go here since I have multiple edits against the database. Can I pass back the result of those edits via a variable and then continue my SSIS Data Flow
    by analyzing the result of my Stored Procedure? And how would I do that.
    I am new to the SSIS game here so please be kind and as explicit as possible. If you know of any good web sites that walk through how to perform SQL server database edits against external data in SSIS or even a YouTube, please let me know.
    Thanks!

    Thanks for that...but can I do multiple edits in my Stored Procedure Vaibhav and pass back something that I can then utilize in my SSIS? For example...
    One and Only one Member Span...so I'd be doing a SELECT COUNT(*) based on my match criteria or handle the count accordingly in my Stored Procedure and passing something back via the OLE DB Command and handling it appropriately in SSIS
    Are there "Diabetes" claims...again probably by analyzing a SELECT COUNT(*)
    Am I expecting too much from the SSIS...should I be doing all of this in a Stored Procedure? I was hoping to use the SSIS GUI for everything but maybe that's just not possible. Rather use the Stored Procedure to analyze my stged data, edit accordingly, do
    data stores accordingly...especially the data anomalies...and then use the SSIS to control navigation
    Your thoughts........
    Could you maybe clarify the difference between an OLE DB Command on the Data Flow and the Execute SQL Task on the Control Flow...
    You can get return values from oledb comand if you want to pipeline.
    see this link for more details
    http://josef-richberg.squarespace.com/journal/2011/6/30/ssis-oledb-command-and-procedure-output-params.html
    The procedure should have an output parameter defined for that
    I belive if you've flexibility of using stored procedure you may be better off doing this in execute sql task in control flow. Calling sp in data flow will cause it to execute sp once for each row in dataset whereas in controlflow it will go for set based
    processing
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • IVI instrument handle data type and palette?

    Hi Folks,
      I'm programming a LabVIEW VI that uses the NI-Scope VIs to talk to a USB-5133. Everything seems to work well, but after calling NI-SCOPE Initialize, I have an 'insturment handle' that needs to be routed to all other NI-SCOPE calls. I'd like to bundle the 'instrument handle' into a cluster to reduce the number of shift registers in the VI, rather than route the handle through its own shift register and as a separate wire everywhere. Can you tell me the data type of 'instrument handle', and where in the palettes to find one, so I can drop it into a cluster?
    Thanks! 

    Hey rogersct,
    The data type for this instrument handle would be an "IVI session of class niScope".  The easiest way to place a constant of this type on your block diagram would be to right-click on the instrument handle output terminal of niScope Initialize.vi and select Create >> Constant.  This should give you a constant of the appropriate data type that you can use to initialize your cluster.
    You can also create a IVI session control from the front panel under I/O >> IVI Logical Name.  You would then need to right-click on the control and select: Select IVI Class >> IviScope >> niScope.  I always use the first method however as it is the quickest.  This should be what you need but if you have any questions please don't hesitate to ask.  Thanks for posting and have a great day!
    -John 
    John Passiak

  • Line graph date sorting and formatting

    Hi Gurus
    We've recently upgraded to 11.1.1.7 and noticed that our Publisher line charts with date on the x-axis are no longer sorting correctly i.e. May comes before March. The reason for this is because in <11.1.1.7 we have a formatted date mask (to_char) in our data model but sorted by the underlying canonical date which worked. Now in 11.1.1.7 it is no longer sorting by the data model sort but by the formatted date string therefore numeric values of 30 April sorted after 1 May.
    We have tried a number of options to resolve:
    1. using the canonical date and sorting on that corrects the sort problem but the default formatting used in long YYYY-MM-DDT00:00:00-00:00 and not readable as our chart is showing daily totals. Changing to time-series chart can allow you to format the date but see problem 2 next...
    2. Time series = yes doesn't display the chart if we have a number of entities in our series i.e. multiple lines and the interactive viewer shows a red error icon. I think this may be due to the fact that our date range is not continuous ie we have a sparse data set.
    3. Workaround we used was a bar chart (our users preference is line charts) with time series = false but the date format is still long.
    Any advice / suggestions would be helpful.
    Thanks
    Nick.

    for #1: numbers does what is called a "stable" sort. Meaning that the previous sort order is preserved. i.e. do your sort in reverse order. Amount, then name, then date. Just did it with sample data and it was perfect. It keeps them in the original order, so if there is a match in name after you sort, you should see the amount still in the proper order.
    #2: What in your formula isnt working? I just made a formula that did math on the columns to the left, sorted and it worked. Sorted by static data columns and the formula column. I know it was broken originally, years ago, but it seems to be working correctly now, at least in my quick test. You might have an issue if you are using formulas that refer to data on other rows or tables.
    #3: yeah formatting can be a pain. But it is easier to do in the desktop program. No, you cannot get it for windows, sorry. If the formatting the only thing you need to do on the desktop side, then i dont see much tying you to it. I do 90% or more on the ipad and iphone now.
    Jason

  • Get cell value in Planning Data form and using it in a business rule

    Hi Everybody,
    if i set the data type of an Account Member as text, is there a way to get the value inserted by the user in a dataform, turning it as dimensional member and using it in a business rule?
    So, if the user insert the value "USA" in a cell, can i use any functions to tell essbase that "USA" is a dimensional member and then using it in a business rule, for example in a cross-dimension like Period1->FY12->USA?
    I tried to use the function @Member and it doesn't work, but i'm wondering if there is a way that can let me get the value inserted and use it just like a dimensional member. What are the ways that can let user input value that can be used in a business rule? I think one is by using SmartList, is there any other ways? Maybe using variables?? As an alternative i tried to use Prompt Variable but there are too many members on which the rule must run.
    Please help me, i wanna know if i can or not let the user input the member on which the rule must run...
    Thank all guys
    Bye
    Maurizio

    Thanks EW for your answer,
    YesI could use SmartList even if i think it's very tough to handle. My experience on using SmartList in caclc script is not so good. I try to enter in details of my requirement:
    I have 500 account members.
    For each one, I have to calculate the monthly budget by sharing the amount among the months. The user wants to calculate it on the basis of the actual flow(over the months) of an unspecified account of the prior year. The unspecified account must be inserted in a data form.
    So, i could use a Smart List but it colud be of 500 elements and then i should make a rule with as many IF as how many are the accounts. Or im wrong? The only way to use smart list dynamically in a business rule is by referring its values in a IF condition. Or i'm wrong.
    I tried to use execution variable ma it seems don't work. In this case the user must pay attention to write the account correctly, otherwise as you say the rule doesn't work.
    The value in PD0A020 is "PD0A000" (that is a dimensional member). The value in PD0A000 is "hello". In PD0A040 the rule returns "PD0A000" and not "hello" as i would. The function @Member appears to be not able to catch the dimensional member by the value in PD0A000.
    {Example}="test"->"Input"->"Scenario_test"->"FY12"->"PD0A020";
    Fix("test1","Input","Scenario_test","FY12")
    "PD0A040"=@Member({Example});
    endfix
    So, my doubt is: is it possible for Essbase/Planning to use the value inserted in a data form and to turn it in a dimensional member? What are the practicable ways to let the user input/choose the member on which makes the rule run?
    Thank you Ew, thank you guys
    Maurizio

Maybe you are looking for