Question: I need to get the neighboring vertices and incident edges from a vertex in a graph. I assume `NeighborhoodVertices` (from the `GraphUtilities` package) can be used for the former. Anything better?

Or given something like `{1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3, 3 \[UndirectedEdge] 1}`, how to directly get these information? Can I do list matching to some pattern?

Answer: 
A random graph

```
 g = RandomGraph[{15, 35}, VertexLabels -> "Name", PlotRangePadding -> .2]

```

![enter image description here](https://i.stack.imgur.com/xdRQ1.png)

Edges for the vertex 4:

```
 EdgeList[g, 4 \[UndirectedEdge] _]

```

Result:

![enter image description here](https://i.stack.imgur.com/lBrY5.png)

Now vertexes around vertex4:

```
 VertexList[NeighborhoodGraph[g, 4]]

```

Result:

```
 {4, 14, 11, 6, 7, 9, 13, 15}

```

Illustration:

```
  HighlightGraph[g, NeighborhoodGraph[g, 4]]

```

![enter image description here](https://i.stack.imgur.com/cwdAG.png)

There are many other ways. You could also use `AdjacencyMatrix` to get all that info.
```
SeedRandom[1]
g = RandomGraph[{15, 35}, VertexLabels -> "Name",  PlotRangePadding  -> .2];

```

Neighboring edges can also be obtained using `IncidenceList`:

```
IncidenceList[g, 4]

```

> 
> {2 <-> 4, 4 <-> 9, 4 <-> 10, 4 <-> 13, 4 <-> 14}
> 
> 
> 

Neighboring vertices can be obtained using `VertexList` or `VertexComponent` on the output of `IncidenceList` 

```
neighborhoodVerticesAndEdges = {VertexList@#, #} &@IncidenceList[g, 4]

```

> 
> {{2, 4, 9, 10, 13, 14}, {2 <-> 4, 4 <-> 9, 4 <-> 10, 4 <-> 13, 4 <-> 14}}
> 
> 
> 

```
{Sort@VertexComponent[#, 4], #} &@IncidenceList[g, 4] == neighborhoodVerticesAndEdges

```

> 
> True
> 
> 
> 

or using `AdjacencyList`:

```
{Union[AdjacencyList@##, {#2}], IncidenceList@##} &[g, 4]  == neighborhoodVerticesAndEdges

```

> 
> True
> 
> 
> 

```
Row[{g, HighlightGraph[g, Join @@ neighborhoodVerticesAndEdges]}]

```

[![enter image description here](https://i.stack.imgur.com/xKksW.jpg)](https://i.stack.imgur.com/xKksW.jpg)