当前位置: 首页> 英语翻译> 正文

planarity是什么 planarity的翻译

  • 作者: 用户投稿
  • 2023-04-14 11:29:38
  • 53

图的欧拉展开(Graph Planarity)是一种图论中的概念,它表明在不交叉的情况下,一个图可以在平面上展开。如果一个图不能够展开到平面上而不会出现交叉,那么这个图就是非欧拉展开的。

1. 定义:图的欧拉展开是指将一个图在平面上展开,使得所有的边都不相交。

2. 性质:图的欧拉展开有三个重要性质:(1)图的欧拉展开是一种无向图;(2)图的欧拉展开中的每条边都不会相交;(3)图的欧拉展开中的每个顶点都有且仅有两条边相连。

3. 算法:图的欧拉展开的算法有很多,其中最常用的是Kuratowski算法,该算法通过检测图中的子图,来判断图是否可以欧拉展开。

4. 代码示例:

// C++ program to check if a given graph is Eulerian or not

#include

#include

using namespace std;

// A class that represents an undirected graph

class Graph

{

int V; // No. of vertices

list*adj; // A dynamic array of adjacency lists

public:

// Constructor and destructor

Graph(int V) { this->V = V; adj = new list[V]; }

~Graph() { delete [] adj; }

// function to add an edge to graph

void addEdge(int v, int w);

// Method to check if this graph is Eulerian or not

int isEulerian();

// Method to check if all non-zero degree vertices are connected

bool isConnected();

// Function to do DFS starting from v. Used in isConnected();

void DFSUtil(int v, bool visited[]);

};

void Graph::addEdge(int v, int w)

{

adj[v].push_back(w); // Add w to v’s list.

adj[w].push_back(v); // Add v to w’s list.

}

void Graph::DFSUtil(int v, bool visited[])

{

// Mark the current node as visited and print it

visited[v] = true;

// Recur for all the vertices adjacent to this vertex

list::iterator i;

for (i = adj[v].begin(); i != adj[v].end(); ++i)

if (!visited[*i])

DFSUtil(*i, visited);

}

// Method to check if all non-zero degree vertices are connected.

// It mainly does DFS traversal starting from

bool Graph::isConnected()

{

// Mark all the vertices as not visited

bool visited[V];

int i;

for (i = 0; i< V; i++)

visited[i] = false;

// Find a vertex with non-zero degree

for (i = 0; i< V; i++)

if (adj[i].size() != 0)

break;

// If there are no edges in the graph, return true

if (i == V)

return true;

// Start DFS traversal from a vertex with non-zero degree

DFS

 
 
  • 3457人参与,13条评论