Git Product home page Git Product logo

se_lab's Introduction

SE_Lab_1

需求分析

  • 功能1:读入文本并生成有向图
  • 功能2:展示有向图
  • 功能3:查询桥接词
  • 功能4:根据bridge word生成新文本
  • 功能5:计算两个单词之间的最短路径
  • 功能6:随机游走

数据结构

使用邻接表来存储有向图

import se.lab.graph.Vertex;

public class se.lab.graph.

MyGraph {
    private int n;  // 顶点数
    private int e;  // 边数
    private final List<Vertex> Adjlist;   // 邻接表
}
import se.lab.graph.Edge;
import se_lab_1.Graph.Edge;

public class se.lab.graph.Vertex {
    private final String name;   // 每个结点的名字
    private final LinkedList<Edge> EdgeList;   // 边表
    private final int index;    // 结点编号
}
import se.lab.graph.Vertex;

public class se_lab_1.Graph.se.lab.graph.

Edge {
    private int weight;  // 边的权重
    private Vertex tail;  // 尾部结点标识
}

功能1

读入文本后通过正则处理,再通过遍历进行有向图的的生成。

功能2

导入 JGraphT 用于图数据结构和 JGraphX 用于图的可视化,添加了缩放控制面板。

功能3

通过遍历图来查询桥接词。

功能4

根据功能3提供的函数实现生成新文本。

功能5

使用dijkstra算法来计算最短路径。

  • 数组S:最短路径已确定的顶点集合
  • 数组D:存放源点到各个顶点的最短距离
  • 数组P:存放最短路径的前驱(后续打印路径进行回溯)

功能6

随机获取初始节点,然后开始游走

  • 使用boolean[][] path来记录走过的路径

se_lab's People

Contributors

lreverse avatar windsland52 avatar

Watchers

 avatar

Forkers

windsland52

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.