Hammer Graph

Author

Eric W. Weisstein
December 22, 2025

This notebook downloaded from https://mathworld.wolfram.com/notebooks/GraphTheory/HammerGraph.nb.

For more information, see Eric's MathWorld entry https://mathworld.wolfram.com/HammerGraph.html.

©2025 Wolfram Research, Inc. except for portions noted otherwise

Figure

Embeddings

GraphicsRow[
Delete[GraphData["HammerGraph","Graph","All"],{2}]//StyleGraphs,
Dividers->All,ImageSize->400]

Complement

GraphicsRow[{
g=GraphData["HammerGraph","Graph",-1];
Show[{
GraphComplement[g,VertexSize->0,EdgeStyle->Dashed],
StyleGraphs@g
}],
Annotate[GraphData["BannerGraph"],EdgeStyle->Dashed]},ImageSize->300]

Embeddings

<<MathWorld`Graphs`

Names

GraphData["HammerGraph","StandardName"]

GraphData["HammerGraph","StandardNames"]

HouseOfGraphs

GraphData["HammerGraph","StandardName"]

hogid=GraphData["HammerGraph","NotationRules","HouseOfGraphs"]

HouseOfGraphsLookup[hogid]

HouseOfGraphsGraph[hogid]//StyleGraphs[#,ImageSize->Small]&

Wikidata

GraphData["HammerGraph","WikidataID"]

GraphData["HammerGraph","WikidataURL"]

Primary

GraphData["HammerGraph"]//StyleGraphs[#,ImageSize->Small]&

All

GraphData["HammerGraph","Graph","All"]//StyleGraphs

CurvedEdge

GraphData["HammerGraph","Graph","CurvedEdge"]//StyleGraphs

Inexact

Select[GraphData["HammerGraph","Graph","All"],(!FreeQ[GraphEmbedding[#],_?InexactNumberQ]&)]//StyleGraphs

Degenerate

GraphData["HammerGraph","Graph","Degenerate"]//StyleGraphs

DegenerateGraphEmbeddingTypes/@GraphData["HammerGraph","Graph","Degenerate"]//Column

Embeddings

GraphDataEmbeddings[GraphData["HammerGraph"]]

Default embedding

GraphPlot[Graph[GraphData["HammerGraph","VertexList"],GraphData["HammerGraph","Edges"]]]

s=Sqrt[3]/2;
v={{0,0},{0,1/4},{0,1/2},{0,1},{s/2,3/4}};
g=Graph[Range@Length@v,UndirectedEdge@@@{e[1,2,3,4,5,3]},VertexCoordinates->v,VertexLabels->Automatic]

RecognizeGraph@g

GeneralizedPetersen

GraphData["HammerGraph","Graph","GeneralizedPetersen"]//StyleGraphs

IGraph

GraphData["HammerGraph","Graph","IGraph"]//StyleGraphs

Bipartite embedding

GraphData["HammerGraph","Bipartite"]

g=Graph[GraphData["HammerGraph","VertexList"],GraphData["HammerGraph","Edges"],GraphLayout->"BipartiteEmbedding"]

Bilateral

GraphData["HammerGraph","Graph","Bilateral"]//StyleGraphs

Grid[DeleteCases[Monitor[{g=#,BilateralGraphEmbeddingTypes[#],GraphSymmetryGroup[#]}&/@GraphData["HammerGraph","Graph","All"],g],{_,_,TransformationGroup[{}]}],Dividers->All,Alignment->{{Center,{Left}}}]//Quiet

Circular

GraphData["HammerGraph","Graph","Circular"]//StyleGraphs

Planar

GraphData["HammerGraph","Planar"]

GraphData["HammerGraph","Graph","Planar"]//StyleGraphs

Planar construction

PlanarGraphEmbedding[GraphData["HammerGraph"],GraphLayout->#]&/@{"TutteLayout","DavidsonHarelLayout"}

Table[PlanarGraphEmbedding[GraphData["HammerGraph"]],10]

PlanarGraphEmbeddings

GraphData["HammerGraph","PlanarEmbeddingCount"]

(plemb=PlanarGraphEmbeddings[GraphData["HammerGraph"],Debug->True])//Timing

Length[plemb]

MinimalCrossing

GraphData["HammerGraph","CN"]

(gs=GraphData["HammerGraph","Graph","MinimalCrossing"])//StyleGraphs

GraphCrossingCount/@gs

GraphCrossingDiagram/@gs

MinimalRectilinearCrossing

GraphData["HammerGraph","RCN"]

GraphData["HammerGraph","Graph","MinimalRectilinearCrossing"]//StyleGraphs

MinimalLocalCrossing

GraphData["HammerGraph",{"LocalCrossingNumber","RectilinearLocalCrossingNumber"}]

GraphData["HammerGraph","Graph","MinimalLocalCrossing"]//StyleGraphs

MinimalRectilinearLocalCrossing

GraphData["HammerGraph",{"LocalCrossingNumber","RectilinearLocalCrossingNumber"}]

GraphData["HammerGraph","Graph","MinimalRectilinearLocalCrossing"]//StyleGraphs

Circulant

GraphData["HammerGraph","Circulant"]

GraphData["HammerGraph","Graph","Circulant"]//StyleGraphs

Circulant construction

GraphData["HammerGraph","NotationRules","Circulant"]

(ci=CirculantIndices[GraphData["HammerGraph"]])//Timing

CirculantGraph1@@@ci

Cases[GraphData["HammerGraph","StandardNames"],{"Circulant",i_}:>i]

CirculantGraph1@@@%

Complement graph

compl=GraphData["HammerGraph","ComplementGraph","Name"]

GraphData[compl,"Graph","All"]

gs=GraphComplement/@%

Select[%,!DegenerateGraphEmbeddingQ[#]&]

Line graph

GraphData["HammerGraph","Line"]

LineGraphQ[GraphData["HammerGraph"]]//Timing

RootGraph

roots=Select[GraphData[All],GraphData[#,"LineGraph","Name"]==="HammerGraph"&]

RootGraph[GraphData["HammerGraph"]]

RecognizeGraph[%]

GraphData[roots[[1]],"Graph","All"]

gs=LineGraph/@%

Halin

GraphData["HammerGraph","Halin"]

GraphData["HammerGraph","Graph","Halin"]//StyleGraphs

Rigid

GraphData["HammerGraph","Rigid"]

GraphData["HammerGraph","Graph","Rigid"]//StyleGraphs

Flexible

GraphData["HammerGraph","Flexible"]

GraphData["HammerGraph","Graph","Flexible"]//StyleGraphs

LCF

GraphData["HammerGraph","LCF"]

GraphData["HammerGraph","HamiltonianCycleCount"]

GraphData["HammerGraph","LCFSignature"]

GraphData["HammerGraph","LCFNotations"]

GraphData["HammerGraph","Graph","LCF"]//StyleGraphs

Tally[LCFNotation[#][[2]]&/@%]

UnitDistance

GraphData["HammerGraph","UnitDistance"]

UnitDistanceGraphQ[GraphData["HammerGraph"],Debug->True]//Timing

GraphData["HammerGraph","Graph","UnitDistance"]//StyleGraphs

Select[%,!FreeQ[GraphEmbedding[#],_?InexactNumberQ]&]

UnitDistance by refinement of default embeddings

Graph[edge list]

(g=UnitDistanceEmbeddingRefine[Graph[GraphData["HammerGraph","EdgeList"]],MaxIterations->500])//Timing

UnitDistanceGraphEmbeddingQ[g]

Graph[vertex list, edge list]

(g=UnitDistanceEmbeddingRefine[Graph[GraphData["HammerGraph","VertexList"],GraphData["HammerGraph","EdgeList"]],MaxIterations->500])//Timing

UnitDistanceGraphEmbeddingQ[g]

UnitDistance by refinement of existing embeddings

gs=UnitDistanceEmbeddingRefine[#,MaxIterations->500]&/@Complement@@(GraphData["HammerGraph","Graph",#]&/@{"All","UnitDistance"})

TextGrid[
gdata=SortBy[
{#,DegenerateGraphEmbeddingQ[#],GraphSymmetryGroup[#],Max[Abs[EdgeLengths[#]-1]]}&/@gs,
Last
],
Dividers->All
]

Cases[gdata,{__,0.}]

Symmetric:

gs=Cases[
gdata,
{g_,_,sym:Except[TransformationGroup[{}]],diff_}:>{
HighlightGraph[g1=BilateralGraph[CenterGraph[g],"ReturnNonbilateralGraph"->True],Flatten[FindCoincidentVertices[g1]]],
sym,
diff
}]

UnitDistance by refinement of stored LCF embeddings

FileByteCount[file="/Volumes/GraphProperties/Properties/LCFNotations/"<>GraphNameToFileName["HammerGraph"]<>".gz"]

Tally[(lcf=Import[file])[[All,-1]]]//Timing//AbsoluteTiming

lcf=LCFNotation/@nicelcfgs;

gs=UnitDistanceEmbeddingRefine[LCFGraph@@#,MaxIterations->500]&/@lcf;//Timing

gdata=SortBy[
{#,Max[Abs[EdgeLengths[#]-1]]}&/@gs,
Last
]

Cases[gdata,{g_?UnitDistanceGraphEmbeddingQ,_}:>g]

NondegenerateSymmetricGraphs=Select[
gdata,
And[
DegenerateGraphEmbeddingQ[#[[1]]]===False,
GraphSymmetryGroup[#[[1]]]=!=TransformationGroup[{}]
]&
]/.g_Graph:>CenterGraph[g]

UnitDistance by FindUnitDistanceEmbedding  (random embeddings returning on messages)

gs=FindUnitDistanceEmbedding[GraphData["HammerGraph"],50,"ReturnWithMessage"->True];//Quiet//Timing

gdata=SortBy[
{#,Max[Abs[EdgeLengths[#]-1]]}&/@gs,
Last
]

Cases[gdata,{g_?UnitDistanceGraphEmbeddingQ,_}:>g]

SymmetricEmebddings=Select[gdata,GraphSymmetryGroup[#[[1]]]=!=TransformationGroup[{}]&]

UnitDistance by FindUnitDistanceEmbedding  (random embedding waiting until UD is found)

FindUnitDistanceEmbedding[GraphData["HammerGraph"],"ReturnWithMessage"->False]//Quiet//Timing

UnitDistance by FindSubgraphUnitDistanceEmbedding

{$Version,DateString[]}

{"HammerGraph",l=FindSubgraphUnitDistanceEmbedding[GraphData["HammerGraph"],TimeConstraint->300,"Results"->All]//Timing}

gs=SortBy[UniqueEmbeddings[l],Replace[RectilinearCrossingCount[#],Infinity->0]&]

Select[IndexGraph/@gs,!DegenerateGraphEmbeddingQ[#]&&GraphSymmetryGroup[#]=!=TransformationGroup[{}]&]//Timing

Matchstick

GraphData["HammerGraph","Matchstick"]

GraphData["HammerGraph","Graph","Matchstick"]//StyleGraphs

3D default

Graph3D[GraphData["HammerGraph","Edges"]]

3D construction

v={};
g=Graph[Range[Length[v]],UndirectedEdge@@@{},VertexCoordinates->v,VertexLabels->Automatic]

RecognizeGraph[g]

3D All

GraphData["HammerGraph","Graph",{"3D","All"}]

3D UnitDistance construction Random

GraphData["HammerGraph","Dimension"]

(g=UnitDistanceEmbeddingRefine[
Graph3D[
GraphData["HammerGraph","VertexList"],
GraphData["HammerGraph","EdgeList"]
],
WorkingPrecision->25])//Timing

EdgeLengths[g]

UnitDistanceGraphEmbeddingQ[g]

3D UnitDistance

GraphData[{"Tadpole",{3,2}},"Graph",{"3D","UnitDistance"}]

3D Polyhedron

GraphData[{"Tadpole",{3,2}},"Polyhedral"]

GraphData[{"Tadpole",{3,2}},"Graph",{"3D","Polyhedron"}]

GraphData

GraphDataClassString

GraphDataClassString["HammerGraph"]