Package cu.repsystestbed.graphs

Examples of cu.repsystestbed.graphs.ReputationGraph


  public void setGraph2Listen(Graph g) throws Exception
  {
    if(!(g instanceof ReputationGraph)) throw new Exception("Can only listen to Reputation Graph.");
   
    super.m_graph2Listen = (ReputationGraph)g;
    if(m_graph2Output == null) m_graph2Output = new ReputationGraph(new ReputationEdgeFactory());
    if(produceCompleteGraph)
    {
      Set<ReputationEdge> edges = ((ReputationGraph)super.m_graph2Listen).edgeSet(); //should be ok to cast here
      for(ReputationEdge edge : edges)
      {
        Agent src = (Agent)edge.src;
        Agent sink = (Agent)edge.sink;
        m_graph2Output.addVertex(src);
        m_graph2Output.addVertex(sink);
        m_graph2Output.addEdge(src, sink);
        //not copying the reputation weights. should you? Probably not.
      }
     
    }else
    {
      ReputationGraph ReputationGraphTransitive = ((ReputationGraph)this.m_graph2Listen).getTransitiveClosureGraph();
      Set<ReputationEdge> edges = ReputationGraphTransitive.edgeSet();
      for(ReputationEdge edge : edges)
      {
        Agent src = (Agent)edge.src;
        Agent sink = (Agent)edge.sink;
        m_graph2Output.addVertex(src);
View Full Code Here


    feedbackHistoryGraph.addObserver(repAlg);
   
    //make eigentrust calculate the reputation of all the agents
    feedbackHistoryGraph.notifyObservers(false);
   
    ReputationGraph repGraph = (ReputationGraph) repAlg.getGraph2Output();
    //TODO display the reputation graph.
   
    RankbasedTrustAlg trustAlg = (RankbasedTrustAlg) TrustAlgorithm.getInstance("cu.repsystestbed.algorithms.RankbasedTrustAlg");
    trustAlg.setRatio(0.7);
    trustAlg.setGraph2Listen(repGraph);
   
    repGraph.addObserver(trustAlg);
   
    repGraph.notifyObservers(null);
   
    TrustGraph trustGraph = (TrustGraph) trustAlg.getGraph2Output();
    //TODO display the trust graph.
   
View Full Code Here

          m_storage.put(t_graphName, fhg);
        }
        else if(t_graphType.toLowerCase().equals("rg"))
        {
          ReputationGraphCreator gen = new ReputationGraphCreator();
          ReputationGraph rg = gen.createGraph(t_graphInputFile);
          m_storage.put(t_graphName, rg);
        }
        else if(t_graphType.toLowerCase().equals("tg"))
        {
          TrustGraphCreator gen = new TrustGraphCreator();
View Full Code Here

            FeedbackHistoryGraph fhg = new FeedbackHistoryGraph(new FeedbackHistoryEdgeFactory());
            m_workflow.addItem(fhg);
            storage.put("int_fhg_" + r.nextInt(1000), fhg);
            break;
          case RG:
            ReputationGraph rg = new ReputationGraph(new ReputationEdgeFactory());
            m_workflow.addItem(rg);
            storage.put("int_rg_" + r.nextInt(1000), rg);
            break;
          case TG:
            TrustGraph tg = new TrustGraph(new TrustEdgeFactory());
View Full Code Here

    BasicConfigurator.configure();
   
    Hashtable<String, Object> storage = new Hashtable<String, Object>();
    storage.put("fhg", new FeedbackHistoryGraph(new FeedbackHistoryEdgeFactory()));
    storage.put("et", new EigenTrust());
    storage.put("rg", new ReputationGraph(new ReputationEdgeFactory()));
    storage.put("as", new Appleseed());
    storage.put("rk", new RankbasedTrustAlg());
    storage.put("tg", new TrustGraph(new TrustEdgeFactory()));
   
    WorkflowParser2 parser = new WorkflowParser2("rg>as>rg", storage);
View Full Code Here

        }
        else if(isGraph(workflowElements[i].trim(), REPUTATIONGRAPH))
        {
          try
          {
            ReputationGraph repGraph = ReputationGraphCreator.createGraph(graphInputFile);
            Util.assertNotNull(repGraph);
            m_workflow.addItem(repGraph);
           
           
          }catch(Exception e)
View Full Code Here

      return new FeedbackHistoryGraph(new FeedbackHistoryEdgeFactory());
     
    }
    else if(graphType.equalsIgnoreCase(REPUTATIONGRAPH))
    {
      return new ReputationGraph(new ReputationEdgeFactory());
     
    }
    else if(graphType.equalsIgnoreCase(TRUSTGRAPH))
    {
      return new TrustGraph(new TrustEdgeFactory());
View Full Code Here

TOP

Related Classes of cu.repsystestbed.graphs.ReputationGraph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.